work to fix bookmaker
Bug: skia:
Change-Id: I2d2766e92b289d827984144b625b3da0fbfee58b
Reviewed-on: https://skia-review.googlesource.com/c/192033
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 93fa499..3adedf1 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -217,20 +217,6 @@
}
SkDebugf("\n");
}
-
- #StdOut
- -----
- ---x-
- ---x-
- ---x-
- ---x-
- ---x-
- ---x-
- -----
- ---x-
- ---x-
- -----
- #StdOut ##
##
#SeeAlso MakeRasterDirect SkRasterHandleAllocator::MakeCanvas SkSurface::getCanvas SkCreateColorSpaceXformCanvas
@@ -267,20 +253,6 @@
}
SkDebugf("\n");
}
-
- #StdOut
- -----
- ---x-
- ---x-
- ---x-
- ---x-
- ---x-
- ---x-
- -----
- ---x-
- ---x-
- -----
- #StdOut ##
##
#SeeAlso MakeRasterDirect SkRasterHandleAllocator::MakeCanvas SkSurface::getCanvas SkCreateColorSpaceXformCanvas
@@ -1353,7 +1325,7 @@
#Member SaveLayerFlags fSaveLayerFlags
#Line # creates with prior Layer contents ##
fSaveLayerFlags are used to create Layer without transparency,
- and to create Layer with the ontents of the previous Layer.
+ and to create Layer with the contents of the previous Layer.
##
#Example
diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh
index 93f3faf..f171f81 100644
--- a/docs/SkPaint_Reference.bmh
+++ b/docs/SkPaint_Reference.bmh
@@ -26,8 +26,7 @@
The objects contained by Paint are opaque, and cannot be edited outside of the Paint
to affect it. The implementation is free to defer computations associated with the
Paint, or ignore them altogether. For instance, some GPU implementations draw all
-Path geometries with Anti_Aliasing, regardless of how SkPaint::kAntiAlias_Flag
-is set in Paint.
+Path geometries with Anti_Aliasing.
Paint describes a single color, a single font, a single image quality, and so on.
Multiple colors are drawn either by using multiple paints or with objects like
@@ -285,8 +284,6 @@
#Line # approximating coverage with transparency ##
Anti_Alias drawing approximates partial pixel coverage with transparency.
-If kAntiAlias_Flag is clear, pixel centers contained by the shape edge are drawn opaque.
-If kAntiAlias_Flag is set, pixels are drawn with Color_Alpha equal to their coverage.
The rule for Aliased pixels is inconsistent across platforms. A shape edge
passing through the pixel center may, but is not required to, draw the pixel.
@@ -303,8 +300,6 @@
The amount of coverage computed for Anti_Aliased pixels also varies across platforms.
Anti_Alias is disabled by default.
-Anti_Alias can be enabled by default by setting SkPaintDefaults_Flags to kAntiAlias_Flag
-at compile time.
#Example
#Width 512
@@ -344,18 +339,8 @@
#Populate
#Example
- SkPaint paint;
- SkDebugf("paint.isAntiAlias() %c= !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)\n",
- paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) ? '=' : '!');
- paint.setAntiAlias(true);
- SkDebugf("paint.isAntiAlias() %c= !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)\n",
- paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) ? '=' : '!');
-
- #StdOut
- paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
- paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
- ##
- ##
+ SkPaint paint;
+##
##
#Method void setAntiAlias(bool aa)
@@ -364,16 +349,8 @@
#Populate
#Example
- SkPaint paint1, paint2;
- paint1.setAntiAlias(true);
- paint2.setFlags(paint2.getFlags() | SkPaint::kAntiAlias_Flag);
- SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
-
- #StdOut
- paint1 == paint2
- ##
- ##
-
+ SkPaint paint;
+##
##
# ------------------------------------------------------------------------------
@@ -392,8 +369,6 @@
kRGBA_F16_SkColorType Surface.
Dither is disabled by default.
-Dither can be enabled by default by setting SkPaintDefaults_Flags to kDither_Flag
-at compile time.
Some platform implementations may ignore dithering. Set #Formula # SK_IGNORE_GPU_DITHER ##
to ignore Dither on GPU_Surface.
@@ -461,18 +436,7 @@
#Example
SkPaint paint;
- SkDebugf("paint.isDither() %c= !!(paint.getFlags() & SkPaint::kDither_Flag)\n",
- paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) ? '=' : '!');
- paint.setDither(true);
- SkDebugf("paint.isDither() %c= !!(paint.getFlags() & SkPaint::kDither_Flag)\n",
- paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) ? '=' : '!');
-
- #StdOut
- paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
- paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
##
- ##
-
##
#Method void setDither(bool dither)
@@ -481,14 +445,7 @@
#Populate
#Example
- SkPaint paint1, paint2;
- paint1.setDither(true);
- paint2.setFlags(paint2.getFlags() | SkPaint::kDither_Flag);
- SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
-
- #StdOut
- paint1 == paint2
- ##
+ SkPaint paint;
##
#SeeAlso kRGB_565_SkColorType
@@ -496,176 +453,6 @@
##
# ------------------------------------------------------------------------------
-#Subtopic Device_Text
-#Line # increase precision of glyph position ##
-
-Font_Anti_Alias and Font_Subpixel increase the precision of glyph position.
-
-When set, Flags kLCDRenderText_Flag takes advantage of the organization of RGB stripes that
-create a color, and relies
-on the small size of the stripe and visual perception to make the color fringing imperceptible.
-Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
-the color components as RGB or BGR.
-
-Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
-As the opaqueness
-of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
-
-Either or both techniques can be enabled.
-kLCDRenderText_Flag and kSubpixelText_Flag are clear by default.
-Font_Anti_Alias or Font_Subpixel can be enabled by default by setting SkPaintDefaults_Flags to
-kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
-
-#Example
- #Description
- Four commas are drawn normally and with combinations of Font_Anti_Alias and Font_Subpixel.
- When Font_Subpixel is disabled, the comma Glyphs are identical, but not evenly spaced.
- When Font_Subpixel is enabled, the comma Glyphs are unique, but appear evenly spaced.
- ##
-
- SkBitmap bitmap;
- bitmap.allocN32Pixels(24, 33);
- SkCanvas offscreen(bitmap);
- offscreen.clear(SK_ColorWHITE);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(20);
- for (bool lcd : { false, true }) {
- paint.setLCDRenderText(lcd);
- for (bool subpixel : { false, true }) {
- paint.setSubpixelText(subpixel);
- offscreen.drawString(",,,,", 0, 4, paint);
- offscreen.translate(0, 7);
- }
- }
- canvas->drawBitmap(bitmap, 4, 12);
- canvas->scale(9, 9);
- canvas->drawBitmap(bitmap, 4, -1);
-##
-#Subtopic Device_Text ##
-
-#Subtopic Linear_Text
-#Line # selects text rendering as Glyph or Path ##
-
-Font_Linear selects whether text is rendered as a Glyph or as a Path.
-If Font_Linear is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
-If Font_Linear is clear, it is the same as setting Hinting to SkFontHinting::kNone.
-#Subtopic Linear_Text ##
-
-#Subtopic Subpixel_Text
-#Line # uses pixel transparency to represent fractional offset ##
-
-Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
-As the opaqueness
-of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
-#Subtopic Subpixel_Text ##
-
-#Subtopic LCD_Text
-#Line # text relying on the order of RGB stripes ##
-
-When set, Font_Anti_Alias takes advantage of the organization of RGB stripes that
-create a color, and relies
-on the small size of the stripe and visual perception to make the color fringing imperceptible.
-Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
-the color components as RGB or BGR.
-#Subtopic LCD_Text ##
-
-# ------------------------------------------------------------------------------
-#Subtopic Embedded_Bitmaps
-#Line # custom sized bitmap Glyphs ##
-
-Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
-Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained
-in a font if the platform supports this option.
-
-FreeType selects the bitmap glyph if available when kEmbeddedBitmapText_Flag is set, and selects
-the outline glyph if kEmbeddedBitmapText_Flag is clear.
-Windows may select the bitmap glyph but is not required to do so.
-OS_X and iOS do not support this option.
-
-Font_Embedded_Bitmaps is disabled by default.
-Font_Embedded_Bitmaps can be enabled by default by setting SkPaintDefaults_Flags to
-kEmbeddedBitmapText_Flag at compile time.
-
-#Example
- #ToDo image will only output on Ubuntu ... how to handle that in fiddle? ##
- #Platform !fiddle
- #Description
- The "hintgasp" TrueType font in the Skia resources/fonts directory
- includes an embedded bitmap Glyph at odd font sizes. This example works
- on platforms that use FreeType as their Font_Engine.
- Windows may, but is not required to, return a bitmap glyph if
- kEmbeddedBitmapText_Flag is set.
- ##
- #Image embeddedbitmap.png
-
- SkBitmap bitmap;
- bitmap.allocN32Pixels(30, 15);
- bitmap.eraseColor(0);
- SkCanvas offscreen(bitmap);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(13);
- paint.setTypeface(MakeResourceAsTypeface("fonts/hintgasp.ttf"));
- for (bool embedded : { false, true}) {
- paint.setEmbeddedBitmapText(embedded);
- offscreen.drawString("A", embedded ? 5 : 15, 15, paint);
- }
- canvas->drawBitmap(bitmap, 0, 0);
- canvas->scale(10, 10);
- canvas->drawBitmap(bitmap, -2, 1);
-##
-#Subtopic Embedded_Bitmaps ##
-
-# ------------------------------------------------------------------------------
-#Subtopic Automatic_Hinting
-#Line # always adjust glyph paths ##
-
-If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Font_Force_Hinting
-instructs the Font_Manager to always hint Glyphs.
-Font_Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
-SkFontHinting::kSlight.
-
-Font_Force_Hinting only affects platforms that use FreeType as the Font_Manager.
-#Subtopic Automatic_Hinting ##
-
-# ------------------------------------------------------------------------------
-
-#Subtopic Fake_Bold
-#Line # approximate font styles ##
-
-Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
-is not available. Skia does not provide font substitution; it is up to the client to find the
-bold font face using the platform Font_Manager.
-
-Use Text_Skew_X to approximate an italic font style when the italic font face
-is not available.
-
-A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
-the font engine to create the bold Glyphs. Otherwise, the extra bold is computed
-by increasing the stroke width and setting the Style to kStrokeAndFill_Style as needed.
-
-Font_Embolden is disabled by default.
-
-#Example
-#Height 128
-void draw(SkCanvas* canvas) {
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setTextSize(40);
- canvas->drawString("OjYy_-", 10, 35, paint);
- paint.setFakeBoldText(true);
- canvas->drawString("OjYy_-", 10, 75, paint);
- // create a custom fake bold by varying the stroke width
- paint.setFakeBoldText(false);
- paint.setStyle(SkPaint::kStrokeAndFill_Style);
- paint.setStrokeWidth(40.f / 48);
- canvas->drawString("OjYy_-", 10, 115, paint);
-}
-##
-#Subtopic Fake_Bold ##
-
-# ------------------------------------------------------------------------------
#Subtopic Filter_Quality_Methods
#Line # get and set Filter_Quality ##
@@ -955,21 +742,21 @@
#Subtopic Stroke ##
As Stroke_Width gets smaller, the drawn path frame is thinner. Stroke_Width less than one
-may have gaps, and if kAntiAlias_Flag is set, Color_Alpha will increase to visually decrease coverage.
+may have gaps, and if antialiasing is on, Color_Alpha will increase to visually decrease coverage.
#SeeAlso Path_Fill_Type Path_Effect Style_Fill Style_Stroke
#Subtopic Style ##
#Subtopic Hairline
Stroke_Width of zero has a special meaning and switches drawing to use Hairline.
-Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels
+Hairline draws the thinnest continuous frame. If antialiasing is off, adjacent pixels
flow horizontally, vertically,or diagonally.
#ToDo what is the description of Anti_Aliased hairlines? ##
Path drawing with Hairline may hit the same pixel more than once. For instance, Path containing
two lines in one Path_Contour will draw the corner point once, but may both lines may draw the adjacent
-pixel. If kAntiAlias_Flag is set, transparency is applied twice, resulting in a darker pixel. Some
+pixel. If antialiasing is on, transparency is applied twice, resulting in a darker pixel. Some
GPU-backed implementations apply transparency at a later drawing stage, avoiding double hit pixels
while stroking.
diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh
index d551144..56e776b 100644
--- a/docs/SkSurface_Reference.bmh
+++ b/docs/SkSurface_Reference.bmh
@@ -18,6 +18,19 @@
# ------------------------------------------------------------------------------
+#Typedef void* ReleaseContext
+#Line # context for release procs ##
+##
+
+#Typedef void (*RenderTargetReleaseProc)(ReleaseContext releaseContext)
+#Line # context for release procs ##
+##
+
+#Typedef void (*TextureReleaseProc)(ReleaseContext releaseContext)
+#Line # context for release procs ##
+##
+
+
#Method static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo& imageInfo, void* pixels,
size_t rowBytes,
const SkSurfaceProps* surfaceProps = nullptr)
@@ -231,7 +244,9 @@
GrSurfaceOrigin origin, int sampleCnt,
SkColorType colorType,
sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps)
+ const SkSurfaceProps* surfaceProps,
+ TextureReleaseProc textureReleaseProc = nullptr,
+ ReleaseContext releaseContext = nullptr)
#In Constructors
#Line # creates Surface from GPU texture ##
#Populate
@@ -266,7 +281,9 @@
GrSurfaceOrigin origin,
SkColorType colorType,
sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps)
+ const SkSurfaceProps* surfaceProps,
+ RenderTargetReleaseProc releaseProc = nullptr,
+ ReleaseContext releaseContext = nullptr)
#In Constructors
#Line # creates Surface from GPU render target ##
#Populate
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index c83769c..35ad418 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -176,6 +176,7 @@
*/
static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded, const SkIRect* subset = nullptr);
+ // Experimental
enum CompressionType {
kETC1_CompressionType, //!< compressed data uses ETC1 compression
};
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index 4ababec..6045078 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -243,7 +243,7 @@
@param colorSpace range of colors
@param surfaceProps LCD striping orientation and setting for device independent
fonts; may be nullptr
- @param renderTargetReleaseProc function called when texture can be released
+ @param releaseProc function called when texture can be released
@param releaseContext state passed to textureReleaseProc
@return SkSurface if all parameters are valid; otherwise, nullptr
*/
@@ -253,7 +253,7 @@
SkColorType colorType,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps,
- TextureReleaseProc textureReleaseProc = nullptr,
+ RenderTargetReleaseProc releaseProc = nullptr,
ReleaseContext releaseContext = nullptr);
/** Wraps a GPU-backed texture into SkSurface. Caller must ensure backendTexture is
@@ -295,7 +295,8 @@
const SkSurfaceProps* surfaceProps);
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
- /** Creates SkSurface from Android hardware buffer.
+ /** Private.
+ Creates SkSurface from Android hardware buffer.
Returned SkSurface takes a reference on the buffer. The ref on the buffer will be released
when the SkSurface is destroyed and there is no pending work on the GPU involving the
buffer.