diff options
-rw-r--r-- | PRESUBMIT.py | 3 | ||||
-rw-r--r-- | debugger/QT/Icons/.qrc | 32 | ||||
-rw-r--r-- | debugger/QT/Icons/doit.bat | 2 | ||||
-rw-r--r-- | docs/SkBitmap_Reference.bmh | 1744 | ||||
-rw-r--r-- | docs/SkPixmap_Reference.bmh | 16 | ||||
-rw-r--r-- | docs/usingBookmaker.bmh | 286 | ||||
-rw-r--r-- | gm/cubicpaths.cpp | 42 | ||||
-rw-r--r-- | src/pathops/SkPathOpsDebug.cpp | 24 | ||||
-rw-r--r-- | src/pathops/SkPathOpsDebug.h | 4 | ||||
-rw-r--r-- | tools/bookmaker/mdOut.cpp | 4 | ||||
-rw-r--r-- | tools/mdbviz/resources.qrc | 8 | ||||
-rw-r--r-- | tools/pathops_sorter.htm | 42 | ||||
-rw-r--r-- | tools/pathops_visualizer.htm | 714 |
13 files changed, 1462 insertions, 1459 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 83e2d58333..c1179151bf 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -222,6 +222,9 @@ def _CommonChecks(input_api, output_api): results.extend( _CheckChangeHasEol( input_api, output_api, source_file_filter=sources)) + results.extend( + input_api.canned_checks.CheckChangeHasNoCR( + input_api, output_api, source_file_filter=sources)) results.extend(_PythonChecks(input_api, output_api)) results.extend(_IfDefChecks(input_api, output_api)) results.extend(_CopyrightChecks(input_api, output_api, diff --git a/debugger/QT/Icons/.qrc b/debugger/QT/Icons/.qrc index dc9075a9fd..82b0f6dba1 100644 --- a/debugger/QT/Icons/.qrc +++ b/debugger/QT/Icons/.qrc @@ -1,17 +1,17 @@ - <!DOCTYPE RCC><RCC version="1.0">
- <qresource>
- <file>skia.png</file>
- <file>delete.png</file>
- <file>breakpoint_16x16.png</file>
- <file>blank.png</file>
- <file>breakpoint.png</file>
- <file>inspector.png</file>
- <file>reload.png</file>
- <file>play.png</file>
- <file>pause.png</file>
- <file>rewind.png</file>
- <file>previous.png</file>
- <file>next.png</file>
- <file>profile.png</file>
- </qresource>
+ <!DOCTYPE RCC><RCC version="1.0"> + <qresource> + <file>skia.png</file> + <file>delete.png</file> + <file>breakpoint_16x16.png</file> + <file>blank.png</file> + <file>breakpoint.png</file> + <file>inspector.png</file> + <file>reload.png</file> + <file>play.png</file> + <file>pause.png</file> + <file>rewind.png</file> + <file>previous.png</file> + <file>next.png</file> + <file>profile.png</file> + </qresource> </RCC>
\ No newline at end of file diff --git a/debugger/QT/Icons/doit.bat b/debugger/QT/Icons/doit.bat index 09d7149f9c..968eb5e07f 100644 --- a/debugger/QT/Icons/doit.bat +++ b/debugger/QT/Icons/doit.bat @@ -1 +1 @@ -c:\Qt\4.8.3\bin\rcc.exe .qrc -o qrc_SkIcons.cpp -no-compress
+c:\Qt\4.8.3\bin\rcc.exe .qrc -o qrc_SkIcons.cpp -no-compress diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh index 03e8a103bb..35f4de6dcb 100644 --- a/docs/SkBitmap_Reference.bmh +++ b/docs/SkBitmap_Reference.bmh @@ -213,19 +213,19 @@ or setPixelRef was called. #Return true if pixels are allocated ## #Example - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));
- SkDebugf("pixel address = %p\n", bitmap.getPixels());
- SkBitmap::HeapAllocator stdalloc;
- if (!stdalloc.allocPixelRef(&bitmap)) {
- SkDebugf("pixel allocation failed\n");
- } else {
- SkDebugf("pixel address = %p\n", bitmap.getPixels());
- }
-#StdOut
-pixel address = (nil)
-pixel address = 0x560ddd0ac670
-##
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType)); + SkDebugf("pixel address = %p\n", bitmap.getPixels()); + SkBitmap::HeapAllocator stdalloc; + if (!stdalloc.allocPixelRef(&bitmap)) { + SkDebugf("pixel allocation failed\n"); + } else { + SkDebugf("pixel address = %p\n", bitmap.getPixels()); + } +#StdOut +pixel address = (nil) +pixel address = 0x560ddd0ac670 +## ## #SeeAlso Allocator tryAllocPixels @@ -262,7 +262,7 @@ void draw(SkCanvas* canvas) { } } #StdOut -width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType
+width: 0 height: 0 color: kUnknown_SkColorType alpha: kUnknown_SkAlphaType width: 25 height: 35 color: kRGBA_8888_SkColorType alpha: kOpaque_SkAlphaType ## ## @@ -283,17 +283,17 @@ allocated, so both bitmaps reference the same pixels. #Return copy of src ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy(original);
- SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+void draw(SkCanvas* canvas) { + SkBitmap original; + original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false"); + SkBitmap copy(original); + SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false"); + SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false"); } #StdOut -original has pixels before copy: true
-original has pixels after copy: true
+original has pixels before copy: true +original has pixels after copy: true copy has pixels: true ## ## @@ -314,17 +314,17 @@ Bitmap. #Return copy of src ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy(std::move(original));
- SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
-}
+void draw(SkCanvas* canvas) { + SkBitmap original; + original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false"); + SkBitmap copy(std::move(original)); + SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false"); + SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false"); +} #StdOut -original has pixels before move: true
-original has pixels after move: false
+original has pixels before move: true +original has pixels after move: false copy has pixels: true ## ## @@ -358,17 +358,17 @@ allocated, so both bitmaps reference the same pixels. #Return copy of src ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy = original;
- SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
+void draw(SkCanvas* canvas) { + SkBitmap original; + original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + SkDebugf("original has pixels before copy: %s\n", original.getPixels() ? "true" : "false"); + SkBitmap copy = original; + SkDebugf("original has pixels after copy: %s\n", original.getPixels() ? "true" : "false"); + SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false"); } #StdOut -original has pixels before copy: true
-original has pixels after copy: true
+original has pixels before copy: true +original has pixels after copy: true copy has pixels: true ## ## @@ -389,17 +389,17 @@ Bitmap. #Return copy of src ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap original;
- original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false");
- SkBitmap copy = std::move(original);
- SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false");
- SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false");
-}
+void draw(SkCanvas* canvas) { + SkBitmap original; + original.tryAllocPixels(SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + SkDebugf("original has pixels before move: %s\n", original.getPixels() ? "true" : "false"); + SkBitmap copy = std::move(original); + SkDebugf("original has pixels after move: %s\n", original.getPixels() ? "true" : "false"); + SkDebugf("copy has pixels: %s\n", copy.getPixels() ? "true" : "false"); +} #StdOut -original has pixels before move: true
-original has pixels after move: false
+original has pixels before move: true +original has pixels after move: false copy has pixels: true ## ## @@ -417,27 +417,27 @@ Swaps the fields of the two bitmaps. #Param other Bitmap exchanged with original ## #Example -void draw(SkCanvas* canvas) {
- auto debugster = [](const char* prefix, const SkBitmap& b) -> void {
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888",
- "Gray_8", "RGBA_F16"};
- SkDebugf("%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\n",
- prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]);
- };
- SkBitmap one, two;
- one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType));
- for (int index = 0; index < 2; ++index) {
- debugster("one", one);
- debugster("two", two);
- one.swap(two);
- }
+void draw(SkCanvas* canvas) { + auto debugster = [](const char* prefix, const SkBitmap& b) -> void { + const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"}; + const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", "RGBA_8888", "BGRA_8888", + "Gray_8", "RGBA_F16"}; + SkDebugf("%s width:%d height:%d colorType:k%s_SkColorType alphaType:k%s_SkAlphaType\n", + prefix, b.width(), b.height(), colors[b.colorType()], alphas[b.alphaType()]); + }; + SkBitmap one, two; + one.tryAllocPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + two.tryAllocPixels(SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType)); + for (int index = 0; index < 2; ++index) { + debugster("one", one); + debugster("two", two); + one.swap(two); + } } #StdOut -one width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType
-two width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
-one width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType
+one width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType +two width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType +one width:2 height:2 colorType:kBGRA_8888_SkColorType alphaType:kPremul_SkAlphaType two width:1 height:1 colorType:kRGBA_8888_SkColorType alphaType:kOpaque_SkAlphaType ## ## @@ -456,17 +456,17 @@ Returns width, height, Alpha_Type, Color_Type, and Color_Space. #Example #Image 4 -void draw(SkCanvas* canvas) {
- // SkBitmap source; // pre-populated with soccer ball by fiddle.skia.org
- const SkImageInfo& info = source.info();
- const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"};
- const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- SkDebugf("width: %d height: %d color: %s alpha: %s\n", info.width(), info.height(),
- colors[info.colorType()], alphas[info.alphaType()]);
-#StdOut
-width: 56 height: 56 color: BGRA_8888 alpha: Opaque
-##
+void draw(SkCanvas* canvas) { + // SkBitmap source; // pre-populated with soccer ball by fiddle.skia.org + const SkImageInfo& info = source.info(); + const char* alphas[] = {"Unknown", "Opaque", "Premul", "Unpremul"}; + const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", + "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"}; + SkDebugf("width: %d height: %d color: %s alpha: %s\n", info.width(), info.height(), + colors[info.colorType()], alphas[info.alphaType()]); +#StdOut +width: 56 height: 56 color: BGRA_8888 alpha: Opaque +## } ## @@ -539,11 +539,11 @@ kBGRA_8888_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType. #Return Color_Type in Image_Info ## #Example - const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::MakeA8(16, 32));
- SkDebugf("color type: k" "%s" "_SkColorType\n", colors[bitmap.colorType()]);
+ const char* colors[] = {"Unknown", "Alpha", "RGB_565", "ARGB_4444", + "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"}; + SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::MakeA8(16, 32)); + SkDebugf("color type: k" "%s" "_SkColorType\n", colors[bitmap.colorType()]); #StdOut color type: kAlpha_SkColorType ## @@ -590,7 +590,7 @@ immutable. SkColorSpace::MakeSRGBLinear creates Color_Space with linear gamma and an sRGB gamut. This Color_Space gamma is not close to sRGB gamma. ## - SkBitmap bitmap;
+ SkBitmap bitmap; bitmap.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, SkColorSpace::MakeSRGBLinear())); SkColorSpace* colorSpace = bitmap.colorSpace(); @@ -620,7 +620,7 @@ The returned Color_Space is immutable. #Return Color_Space in Image_Info wrapped in a smart pointer ## #Example - SkBitmap bitmap1, bitmap2;
+ SkBitmap bitmap1, bitmap2; bitmap1.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, SkColorSpace::MakeSRGBLinear())); bitmap2.setInfo(SkImageInfo::MakeN32(16, 32, kPremul_SkAlphaType, @@ -663,13 +663,13 @@ Returns zero if colorType( is kUnknown_SkColorType. bitmap.bytesPerPixel()); } #StdOut -color: kUnknown_SkColorType bytesPerPixel: 0
-color: kAlpha_SkColorType bytesPerPixel: 1
-color: kRGB_565_SkColorType bytesPerPixel: 2
-color: kARGB_4444_SkColorType bytesPerPixel: 2
-color: kRGBA_8888_SkColorType bytesPerPixel: 4
-color: kBGRA_8888_SkColorType bytesPerPixel: 4
-color: kGray_8_SkColorType bytesPerPixel: 1
+color: kUnknown_SkColorType bytesPerPixel: 0 +color: kAlpha_SkColorType bytesPerPixel: 1 +color: kRGB_565_SkColorType bytesPerPixel: 2 +color: kARGB_4444_SkColorType bytesPerPixel: 2 +color: kRGBA_8888_SkColorType bytesPerPixel: 4 +color: kBGRA_8888_SkColorType bytesPerPixel: 4 +color: kGray_8_SkColorType bytesPerPixel: 1 color: kRGBA_F16_SkColorType bytesPerPixel: 8 ## ## @@ -730,13 +730,13 @@ Returns zero for kUnknown_SkColorType. bitmap.shiftPerPixel()); } #StdOut -color: kUnknown_SkColorType shiftPerPixel: 0
-color: kAlpha_SkColorType shiftPerPixel: 0
-color: kRGB_565_SkColorType shiftPerPixel: 1
-color: kARGB_4444_SkColorType shiftPerPixel: 1
-color: kRGBA_8888_SkColorType shiftPerPixel: 2
-color: kBGRA_8888_SkColorType shiftPerPixel: 2
-color: kGray_8_SkColorType shiftPerPixel: 0
+color: kUnknown_SkColorType shiftPerPixel: 0 +color: kAlpha_SkColorType shiftPerPixel: 0 +color: kRGB_565_SkColorType shiftPerPixel: 1 +color: kARGB_4444_SkColorType shiftPerPixel: 1 +color: kRGBA_8888_SkColorType shiftPerPixel: 2 +color: kBGRA_8888_SkColorType shiftPerPixel: 2 +color: kGray_8_SkColorType shiftPerPixel: 0 color: kRGBA_F16_SkColorType shiftPerPixel: 3 ## ## @@ -789,15 +789,15 @@ width(), height(), and Pixel_Ref. #Return true if no Pixel_Ref is associated ## #Example - SkBitmap bitmap;
- SkDebugf("empty bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
- bitmap.setInfo(SkImageInfo::MakeA8(8, 8));
- SkDebugf("bitmap with dimensions does %shave pixels\n", bitmap.isNull() ? "not " : "");
- bitmap.allocPixels();
- SkDebugf("allocated bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
+ SkBitmap bitmap; + SkDebugf("empty bitmap does %shave pixels\n", bitmap.isNull() ? "not " : ""); + bitmap.setInfo(SkImageInfo::MakeA8(8, 8)); + SkDebugf("bitmap with dimensions does %shave pixels\n", bitmap.isNull() ? "not " : ""); + bitmap.allocPixels(); + SkDebugf("allocated bitmap does %shave pixels\n", bitmap.isNull() ? "not " : ""); #StdOut -empty bitmap does not have pixels
-bitmap with dimensions does not have pixels
+empty bitmap does not have pixels +bitmap with dimensions does not have pixels allocated bitmap does have pixels ## ## @@ -816,21 +816,21 @@ If true, Bitmap has no effect when drawn or drawn into. #Return true if drawing has no effect ## #Example - SkBitmap bitmap;
- for (int w : { 0, 8 } ) {
- for (bool allocate : { false, true} ) {
- bitmap.setInfo(SkImageInfo::MakeA8(w, 8));
- allocate ? bitmap.allocPixels() : (void) 0 ;
- SkDebugf("empty:%s isNull:%s drawsNothing:%s\n", bitmap.empty() ? "true " : "false",
- bitmap.isNull() ? "true " : "false", bitmap.drawsNothing() ? "true" : "false");
- }
- }
-#StdOut
-empty:true isNull:true drawsNothing:true
-empty:true isNull:false drawsNothing:true
-empty:false isNull:true drawsNothing:true
-empty:false isNull:false drawsNothing:false
-##
+ SkBitmap bitmap; + for (int w : { 0, 8 } ) { + for (bool allocate : { false, true} ) { + bitmap.setInfo(SkImageInfo::MakeA8(w, 8)); + allocate ? bitmap.allocPixels() : (void) 0 ; + SkDebugf("empty:%s isNull:%s drawsNothing:%s\n", bitmap.empty() ? "true " : "false", + bitmap.isNull() ? "true " : "false", bitmap.drawsNothing() ? "true" : "false"); + } + } +#StdOut +empty:true isNull:true drawsNothing:true +empty:true isNull:false drawsNothing:true +empty:false isNull:true drawsNothing:true +empty:false isNull:false drawsNothing:false +## ## #SeeAlso empty() isNull pixelRef @@ -854,15 +854,15 @@ setInfo is not large enough to hold a row of pixels. #Return byte length of pixel row ## #Example - SkBitmap bitmap;
- for (int rowBytes : { 2, 8 } ) {
- bool result = bitmap.setInfo(SkImageInfo::MakeA8(4, 4), rowBytes);
- SkDebugf("setInfo returned:%s rowBytes:%d\n", result ? "true " : "false", bitmap.rowBytes());
- }
-#StdOut
-setInfo returned:false rowBytes:0
-setInfo returned:true rowBytes:8
-##
+ SkBitmap bitmap; + for (int rowBytes : { 2, 8 } ) { + bool result = bitmap.setInfo(SkImageInfo::MakeA8(4, 4), rowBytes); + SkDebugf("setInfo returned:%s rowBytes:%d\n", result ? "true " : "false", bitmap.rowBytes()); + } +#StdOut +setInfo returned:false rowBytes:0 +setInfo returned:true rowBytes:8 +## ## #SeeAlso info() setInfo SkImageInfo::minRowBytes @@ -903,29 +903,29 @@ are affected. #Return true if Alpha_Type is set ## #Example -void draw(SkCanvas* canvas) {
- const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444",
- "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"};
- const char* alphas[] = {"Unknown ", "Opaque ", "Premul ", "Unpremul"};
-
- SkBitmap bitmap;
- SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType,
- kPremul_SkAlphaType, kUnpremul_SkAlphaType };
- SkDebugf("%88s", "Canonical Unknown Opaque Premul Unpremul\n");
- for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
- kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
- kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
- for (SkAlphaType canonicalAlphaType : alphaTypes) {
- SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType );
- SkDebugf("%10s %10s ", colors[(int) colorType], alphas[(int) canonicalAlphaType ]);
- for (SkAlphaType alphaType : alphaTypes) {
- bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));
- bool result = bitmap.setAlphaType(alphaType);
- SkDebugf("%s %s ", result ? "true " : "false", alphas[(int) bitmap.alphaType()]);
- }
- SkDebugf("\n");
- }
- }
+void draw(SkCanvas* canvas) { + const char* colors[] = {"Unknown", "Alpha_8", "RGB_565", "ARGB_4444", + "RGBA_8888", "BGRA_8888", "Gray_8", "RGBA_F16"}; + const char* alphas[] = {"Unknown ", "Opaque ", "Premul ", "Unpremul"}; + + SkBitmap bitmap; + SkAlphaType alphaTypes[] = { kUnknown_SkAlphaType, kOpaque_SkAlphaType, + kPremul_SkAlphaType, kUnpremul_SkAlphaType }; + SkDebugf("%88s", "Canonical Unknown Opaque Premul Unpremul\n"); + for (SkColorType colorType : { kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, + kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType, + kGray_8_SkColorType, kRGBA_F16_SkColorType } ) { + for (SkAlphaType canonicalAlphaType : alphaTypes) { + SkColorTypeValidateAlphaType(colorType, kUnknown_SkAlphaType, &canonicalAlphaType ); + SkDebugf("%10s %10s ", colors[(int) colorType], alphas[(int) canonicalAlphaType ]); + for (SkAlphaType alphaType : alphaTypes) { + bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType)); + bool result = bitmap.setAlphaType(alphaType); + SkDebugf("%s %s ", result ? "true " : "false", alphas[(int) bitmap.alphaType()]); + } + SkDebugf("\n"); + } + } } ## @@ -942,18 +942,18 @@ Returns pixel address, the base address corresponding to the pixel origin. #Return pixel address ## #Example - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));
- bitmap.allocPixels();
- bitmap.eraseColor(0x00000000);
- void* baseAddr = bitmap.getPixels();
- *(SkPMColor*)baseAddr = 0xFFFFFFFF;
- SkDebugf("bitmap.getColor(0, 1) %c= 0x00000000\n",
- bitmap.getColor(0, 1) == 0x00000000 ? '=' : '!');
- SkDebugf("bitmap.getColor(0, 0) %c= 0xFFFFFFFF\n",
- bitmap.getColor(0, 0) == 0xFFFFFFFF ? '=' : '!');
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType)); + bitmap.allocPixels(); + bitmap.eraseColor(0x00000000); + void* baseAddr = bitmap.getPixels(); + *(SkPMColor*)baseAddr = 0xFFFFFFFF; + SkDebugf("bitmap.getColor(0, 1) %c= 0x00000000\n", + bitmap.getColor(0, 1) == 0x00000000 ? '=' : '!'); + SkDebugf("bitmap.getColor(0, 0) %c= 0xFFFFFFFF\n", + bitmap.getColor(0, 0) == 0xFFFFFFFF ? '=' : '!'); #StdOut -bitmap.getColor(0, 1) == 0x00000000
+bitmap.getColor(0, 1) == 0x00000000 bitmap.getColor(0, 0) == 0xFFFFFFFF ## ## @@ -975,7 +975,7 @@ Returns height() times rowBytes if colorType is kUnknown_SkColorType. #Return size in bytes of image buffer ## #Example - SkBitmap bitmap;
+ SkBitmap bitmap; for (int width : { 1, 1000, 1000000 } ) { for (int height: { 1, 1000, 1000000 } ) { SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType); @@ -985,14 +985,14 @@ Returns height() times rowBytes if colorType is kUnknown_SkColorType. } } #StdOut -width: 1 height: 1 computeByteSize: 4
-width: 1 height: 1000 computeByteSize: 4999
-width: 1 height: 1000000 computeByteSize: 4999999
-width: 1000 height: 1 computeByteSize: 4000
-width: 1000 height: 1000 computeByteSize: 4999000
-width: 1000 height: 1000000 computeByteSize: 4999999000
-width: 1000000 height: 1 computeByteSize: 4000000
-width: 1000000 height: 1000 computeByteSize: 4999000000
+width: 1 height: 1 computeByteSize: 4 +width: 1 height: 1000 computeByteSize: 4999 +width: 1 height: 1000000 computeByteSize: 4999999 +width: 1000 height: 1 computeByteSize: 4000 +width: 1000 height: 1000 computeByteSize: 4999000 +width: 1000 height: 1000000 computeByteSize: 4999999000 +width: 1000000 height: 1 computeByteSize: 4000000 +width: 1000000 height: 1000 computeByteSize: 4999000000 width: 1000000 height: 1000000 computeByteSize: 4999999000000 ## ## @@ -1017,25 +1017,25 @@ result may exceed 32 bits. #Description getSize results are not useful when width() and height() are large. ## -void draw(SkCanvas* canvas) {
- SkBitmap bitmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- bitmap.setInfo(imageInfo, width * 5);
- SkDebugf("width: %7d height: %7d getSize: %9zu\n", width, height, bitmap.getSize());
- }
- }
+void draw(SkCanvas* canvas) { + SkBitmap bitmap; + for (int width : { 1, 1000, 1000000 } ) { + for (int height: { 1, 1000, 1000000 } ) { + SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType); + bitmap.setInfo(imageInfo, width * 5); + SkDebugf("width: %7d height: %7d getSize: %9zu\n", width, height, bitmap.getSize()); + } + } } #StdOut -width: 1 height: 1 getSize: 5
-width: 1 height: 1000 getSize: 5000
-width: 1 height: 1000000 getSize: 5000000
-width: 1000 height: 1 getSize: 5000
-width: 1000 height: 1000 getSize: 5000000
-width: 1000 height: 1000000 getSize: 705032704
-width: 1000000 height: 1 getSize: 5000000
-width: 1000000 height: 1000 getSize: 705032704
+width: 1 height: 1 getSize: 5 +width: 1 height: 1000 getSize: 5000 +width: 1 height: 1000000 getSize: 5000000 +width: 1000 height: 1 getSize: 5000 +width: 1000 height: 1000 getSize: 5000000 +width: 1000 height: 1000000 getSize: 705032704 +width: 1000000 height: 1 getSize: 5000000 +width: 1000000 height: 1000 getSize: 705032704 width: 1000000 height: 1000000 getSize: 658067456 ## ## @@ -1063,25 +1063,25 @@ beyond the result may generate an exception. #Description getSafeSize results are not useful when width() and height() are large. ## -void draw(SkCanvas* canvas) {
- SkBitmap bitmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- bitmap.setInfo(imageInfo, width * 5);
- SkDebugf("width: %7d height: %7d getSafeSize: %9zu\n", width, height, bitmap.getSafeSize());
- }
- }
+void draw(SkCanvas* canvas) { + SkBitmap bitmap; + for (int width : { 1, 1000, 1000000 } ) { + for (int height: { 1, 1000, 1000000 } ) { + SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType); + bitmap.setInfo(imageInfo, width * 5); + SkDebugf("width: %7d height: %7d getSafeSize: %9zu\n", width, height, bitmap.getSafeSize()); + } + } } #StdOut -width: 1 height: 1 getSafeSize: 4
-width: 1 height: 1000 getSafeSize: 4999
-width: 1 height: 1000000 getSafeSize: 4999999
-width: 1000 height: 1 getSafeSize: 4000
-width: 1000 height: 1000 getSafeSize: 4999000
-width: 1000 height: 1000000 getSafeSize: 0
-width: 1000000 height: 1 getSafeSize: 4000000
-width: 1000000 height: 1000 getSafeSize: 0
+width: 1 height: 1 getSafeSize: 4 +width: 1 height: 1000 getSafeSize: 4999 +width: 1 height: 1000000 getSafeSize: 4999999 +width: 1000 height: 1 getSafeSize: 4000 +width: 1000 height: 1000 getSafeSize: 4999000 +width: 1000 height: 1000000 getSafeSize: 0 +width: 1000000 height: 1 getSafeSize: 4000000 +width: 1000000 height: 1000 getSafeSize: 0 width: 1000000 height: 1000000 getSafeSize: 0 ## ## @@ -1100,26 +1100,26 @@ Includes unused memory on last row when rowBytesAsPixels exceeds width(). #Return conservative pixel storage size ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap bitmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- bitmap.setInfo(imageInfo, width * 5);
- SkDebugf("width: %7d height: %7d computeSize64: %13lld\n", width, height,
- bitmap.computeSize64());
- }
- }
+void draw(SkCanvas* canvas) { + SkBitmap bitmap; + for (int width : { 1, 1000, 1000000 } ) { + for (int height: { 1, 1000, 1000000 } ) { + SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType); + bitmap.setInfo(imageInfo, width * 5); + SkDebugf("width: %7d height: %7d computeSize64: %13lld\n", width, height, + bitmap.computeSize64()); + } + } } #StdOut -width: 1 height: 1 computeSize64: 5
-width: 1 height: 1000 computeSize64: 5000
-width: 1 height: 1000000 computeSize64: 5000000
-width: 1000 height: 1 computeSize64: 5000
-width: 1000 height: 1000 computeSize64: 5000000
-width: 1000 height: 1000000 computeSize64: 5000000000
-width: 1000000 height: 1 computeSize64: 5000000
-width: 1000000 height: 1000 computeSize64: 5000000000
+width: 1 height: 1 computeSize64: 5 +width: 1 height: 1000 computeSize64: 5000 +width: 1 height: 1000000 computeSize64: 5000000 +width: 1000 height: 1 computeSize64: 5000 +width: 1000 height: 1000 computeSize64: 5000000 +width: 1000 height: 1000000 computeSize64: 5000000000 +width: 1000000 height: 1 computeSize64: 5000000 +width: 1000000 height: 1000 computeSize64: 5000000000 width: 1000000 height: 1000000 computeSize64: 5000000000000 ## ## @@ -1138,26 +1138,26 @@ Does not include unused memory on last row when rowBytesAsPixels exceeds width() #Return exact pixel storage size ## #Example -void draw(SkCanvas* canvas) {
- SkBitmap bitmap;
- for (int width : { 1, 1000, 1000000 } ) {
- for (int height: { 1, 1000, 1000000 } ) {
- SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
- bitmap.setInfo(imageInfo, width * 5);
- SkDebugf("width: %7d height: %7d computeSafeSize64: %13lld\n", width, height,
- bitmap.computeSafeSize64());
- }
- }
+void draw(SkCanvas* canvas) { + SkBitmap bitmap; + for (int width : { 1, 1000, 1000000 } ) { + for (int height: { 1, 1000, 1000000 } ) { + SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType); + bitmap.setInfo(imageInfo, width * 5); + SkDebugf("width: %7d height: %7d computeSafeSize64: %13lld\n", width, height, + bitmap.computeSafeSize64()); + } + } } #StdOut -width: 1 height: 1 computeSafeSize64: 4
-width: 1 height: 1000 computeSafeSize64: 4999
-width: 1 height: 1000000 computeSafeSize64: 4999999
-width: 1000 height: 1 computeSafeSize64: 4000
-width: 1000 height: 1000 computeSafeSize64: 4999000
-width: 1000 height: 1000000 computeSafeSize64: 4999999000
-width: 1000000 height: 1 computeSafeSize64: 4000000
-width: 1000000 height: 1000 computeSafeSize64: 4999000000
+width: 1 height: 1 computeSafeSize64: 4 +width: 1 height: 1000 computeSafeSize64: 4999 +width: 1 height: 1000000 computeSafeSize64: 4999999 +width: 1000 height: 1 computeSafeSize64: 4000 +width: 1000 height: 1000 computeSafeSize64: 4999000 +width: 1000 height: 1000000 computeSafeSize64: 4999999000 +width: 1000000 height: 1 computeSafeSize64: 4000000 +width: 1000000 height: 1000 computeSafeSize64: 4999000000 width: 1000000 height: 1000000 computeSafeSize64: 4999999000000 ## ## @@ -1177,17 +1177,17 @@ Most immutable Bitmap checks trigger an assert only on debug builds. #Return true if pixels are immutable ## #Example - SkBitmap original;
- SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
- if (original.tryAllocPixels(info)) {
- original.setImmutable();
- SkBitmap copy;
- original.extractSubset(©, {5, 10, 15, 20});
- SkDebugf("original is " "%s" "immutable\n", original.isImmutable() ? "" : "not ");
- SkDebugf("copy is " "%s" "immutable\n", copy.isImmutable() ? "" : "not ");
+ SkBitmap original; + SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType); + if (original.tryAllocPixels(info)) { + original.setImmutable(); + SkBitmap copy; + original.extractSubset(©, {5, 10, 15, 20}); + SkDebugf("original is " "%s" "immutable\n", original.isImmutable() ? "" : "not "); + SkDebugf("copy is " "%s" "immutable\n", copy.isImmutable() ? "" : "not "); } #StdOut -original is immutable
+original is immutable copy is immutable ## ## @@ -1210,14 +1210,14 @@ Writing to immutable Bitmap pixels triggers an assert on debug builds. #Description Triggers assert if SK_DEBUG is true, runs fine otherwise. ## - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType));
- bitmap.allocPixels();
- SkCanvas offscreen(bitmap);
- SkDebugf("draw white\n");
- offscreen.clear(SK_ColorWHITE);
- bitmap.setImmutable();
- SkDebugf("draw black\n");
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::MakeN32(4, 4, kPremul_SkAlphaType)); + bitmap.allocPixels(); + SkCanvas offscreen(bitmap); + SkDebugf("draw white\n"); + offscreen.clear(SK_ColorWHITE); + bitmap.setImmutable(); + SkDebugf("draw black\n"); offscreen.clear(SK_ColorBLACK); ## @@ -1239,18 +1239,18 @@ transparency. #Description isOpaque ignores whether all pixels are opaque or not. ## - const int height = 2;
- const int width = 2;
- SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType));
- for (int index = 0; index < 2; ++index) {
- bitmap.allocPixels();
- bitmap.eraseColor(0x00000000);
- SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false");
- bitmap.eraseColor(0xFFFFFFFF);
- SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false");
- bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType));
- }
+ const int height = 2; + const int width = 2; + SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType)); + for (int index = 0; index < 2; ++index) { + bitmap.allocPixels(); + bitmap.eraseColor(0x00000000); + SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false"); + bitmap.eraseColor(0xFFFFFFFF); + SkDebugf("isOpaque: %s\n", bitmap.isOpaque() ? "true" : "false"); + bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType)); + } #StdOut isOpaque: false isOpaque: false @@ -1275,17 +1275,17 @@ Volatile state is not shared by other bitmaps sharing the same Pixel_Ref. #Return true if marked volatile ## #Example - SkBitmap original;
- SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
- if (original.tryAllocPixels(info)) {
- original.setIsVolatile(true);
- SkBitmap copy;
- original.extractSubset(©, {5, 10, 15, 20});
- SkDebugf("original is " "%s" "volatile\n", original.isVolatile() ? "" : "not ");
- SkDebugf("copy is " "%s" "volatile\n", copy.isImmutable() ? "" : "not ");
- }
+ SkBitmap original; + SkImageInfo info = SkImageInfo::Make(25, 35, kRGBA_8888_SkColorType, kOpaque_SkAlphaType); + if (original.tryAllocPixels(info)) { + original.setIsVolatile(true); + SkBitmap copy; + original.extractSubset(©, {5, 10, 15, 20}); + SkDebugf("original is " "%s" "volatile\n", original.isVolatile() ? "" : "not "); + SkDebugf("copy is " "%s" "volatile\n", copy.isImmutable() ? "" : "not "); + } #StdOut -original is volatile
+original is volatile copy is not volatile ## ## @@ -1309,17 +1309,17 @@ consumption on Device. #Example #Height 20 - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- bitmap.allocPixels();
- bitmap.eraseColor(SK_ColorRED);
- canvas->scale(16, 16);
- canvas->drawBitmap(bitmap, 0, 0);
- *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE);
- canvas->drawBitmap(bitmap, 2, 0);
- bitmap.setIsVolatile(true);
- *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN);
- canvas->drawBitmap(bitmap, 4, 0);
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + bitmap.allocPixels(); + bitmap.eraseColor(SK_ColorRED); + canvas->scale(16, 16); + canvas->drawBitmap(bitmap, 0, 0); + *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE); + canvas->drawBitmap(bitmap, 2, 0); + bitmap.setIsVolatile(true); + *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN); + canvas->drawBitmap(bitmap, 4, 0); ## #SeeAlso isVolatile @@ -1340,18 +1340,18 @@ If Pixel_Ref is allocated, its reference count is decreased by one, releasing its memory if Bitmap is the sole owner. #Example - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- bitmap.allocPixels();
- SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(),
- bitmap.isNull() ? "true" : "false");
- bitmap.reset();
- SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(),
- bitmap.isNull() ? "true" : "false");
-#StdOut
-width:1 height:1 isNull:false
-width:0 height:0 isNull:true
-##
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + bitmap.allocPixels(); + SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(), + bitmap.isNull() ? "true" : "false"); + bitmap.reset(); + SkDebugf("width:%d height:%d isNull:%s\n", bitmap.width(), bitmap.height(), + bitmap.isNull() ? "true" : "false"); +#StdOut +width:1 height:1 isNull:false +width:0 height:0 isNull:true +## ## #SeeAlso SkBitmap() SkAlphaType SkColorType @@ -1381,15 +1381,15 @@ Returns false for kUnknown_SkColorType. #Return true if all pixels have opaque values or Color_Type is opaque ## #Example - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(2, 2, kN32_SkColorType, kPremul_SkAlphaType));
- for (int index = 0; index < 2; ++index) {
- bitmap.allocPixels();
- bitmap.eraseColor(0x00000000);
- SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
- bitmap.eraseColor(0xFFFFFFFF);
- SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
- bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType));
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(2, 2, kN32_SkColorType, kPremul_SkAlphaType)); + for (int index = 0; index < 2; ++index) { + bitmap.allocPixels(); + bitmap.eraseColor(0x00000000); + SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false"); + bitmap.eraseColor(0xFFFFFFFF); + SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false"); + bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType)); } #StdOut computeIsOpaque: false @@ -1414,14 +1414,14 @@ Returns Rect { 0, 0, width(), height() }. #Example #Height 160 #Image 3 - SkRect bounds;
- source.getBounds(&bounds);
- bounds.offset(100, 100);
- SkPaint paint;
- paint.setColor(SK_ColorGRAY);
- canvas->scale(.25f, .25f);
- canvas->drawRect(bounds, paint);
- canvas->drawBitmap(source, 40, 40);
+ SkRect bounds; + source.getBounds(&bounds); + bounds.offset(100, 100); + SkPaint paint; + paint.setColor(SK_ColorGRAY); + canvas->scale(.25f, .25f); + canvas->drawRect(bounds, paint); + canvas->drawBitmap(source, 40, 40); ## #SeeAlso bounds() @@ -1438,13 +1438,13 @@ Returns IRect { 0, 0, width(), height() }. #Example #Image 3 - SkIRect bounds;
- source.getBounds(&bounds);
- bounds.inset(100, 100);
- SkBitmap bitmap;
- source.extractSubset(&bitmap, bounds);
- canvas->scale(.5f, .5f);
- canvas->drawBitmap(bitmap, 10, 10);
+ SkIRect bounds; + source.getBounds(&bounds); + bounds.inset(100, 100); + SkBitmap bitmap; + source.extractSubset(&bitmap, bounds); + canvas->scale(.5f, .5f); + canvas->drawBitmap(bitmap, 10, 10); ## #SeeAlso bounds() @@ -1461,12 +1461,12 @@ Returns IRect { 0, 0, width(), height() }. #Example #Image 4 - SkIRect bounds = source.bounds();
- for (int x : { 0, bounds.width() } ) {
- for (int y : { 0, bounds.height() } ) {
- canvas->drawBitmap(source, x, y);
- }
- }
+ SkIRect bounds = source.bounds(); + for (int x : { 0, bounds.width() } ) { + for (int y : { 0, bounds.height() } ) { + canvas->drawBitmap(source, x, y); + } + } ## #SeeAlso getBounds @@ -1482,13 +1482,13 @@ Returns ISize { width(), height() }. #Return integral size of width() and height() ## #Example - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::MakeN32(33, 55, kOpaque_SkAlphaType));
- SkISize dimensions = bitmap.dimensions();
- SkRect bounds;
- bitmap.getBounds(&bounds);
- SkRect dimensionsAsBounds = SkRect::Make(dimensions);
- SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!');
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::MakeN32(33, 55, kOpaque_SkAlphaType)); + SkISize dimensions = bitmap.dimensions(); + SkRect bounds; + bitmap.getBounds(&bounds); + SkRect dimensionsAsBounds = SkRect::Make(dimensions); + SkDebugf("dimensionsAsBounds %c= bounds\n", dimensionsAsBounds == bounds ? '=' : '!'); ## #SeeAlso height() width() @@ -1505,19 +1505,19 @@ Returns the bounds of this bitmap, offset by its Pixel_Ref origin. #Example #Image 3 - SkIRect bounds;
- source.getBounds(&bounds);
- bounds.inset(100, 100);
- SkBitmap subset;
- source.extractSubset(&subset, bounds);
- SkIRect r = source.getSubset();
- SkDebugf("source: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
- r = subset.getSubset();
- SkDebugf("subset: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom);
-#StdOut
-source: 0, 0, 512, 512
-subset: 100, 100, 412, 412
-##
+ SkIRect bounds; + source.getBounds(&bounds); + bounds.inset(100, 100); + SkBitmap subset; + source.extractSubset(&subset, bounds); + SkIRect r = source.getSubset(); + SkDebugf("source: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom); + r = subset.getSubset(); + SkDebugf("subset: %d, %d, %d, %d\n", r.fLeft, r.fTop, r.fRight, r.fBottom); +#StdOut +source: 0, 0, 512, 512 +subset: 100, 100, 412, 412 +## ## #SeeAlso extractSubset getBounds @@ -1563,16 +1563,16 @@ Calls reset() and returns false if: #Example #Height 96 ###^ -SkBitmap bitmap;
-bitmap.setInfo(SkImageInfo::MakeN32(44, 16, kOpaque_SkAlphaType));
-bitmap.allocPixels();
-bitmap.eraseColor(SK_ColorGREEN);
-SkCanvas offscreen(bitmap);
-SkPaint paint;
-offscreen.drawString("!@#$%", 0, 12, paint);
-canvas->scale(6, 6);
-canvas->drawBitmap(bitmap, 0, 0);
-^^^#
+SkBitmap bitmap; +bitmap.setInfo(SkImageInfo::MakeN32(44, 16, kOpaque_SkAlphaType)); +bitmap.allocPixels(); +bitmap.eraseColor(SK_ColorGREEN); +SkCanvas offscreen(bitmap); +SkPaint paint; +offscreen.drawString("!@#$%", 0, 12, paint); +canvas->scale(6, 6); +canvas->drawBitmap(bitmap, 0, 0); +^^^# ## #SeeAlso Alpha_Type Color_Type Color_Space height rowBytes width @@ -1634,18 +1634,18 @@ requires 40,000,000,000 bytes of storage. Allocator implemented internally by SkMallocPixelRef::MakeZeroed limits the maximum memory allowed; the allocation must fit in 31 bits. ## - SkBitmap bitmap;
- int loop = 0;
- while (++loop) {
- SkDebugf("attempt %d\n", loop);
- if (!bitmap.tryAllocPixelsFlags(SkImageInfo::MakeN32(100000, 100000, kOpaque_SkAlphaType),
- SkBitmap::kZeroPixels_AllocFlag)) {
- SkDebugf("failed!\n");
- break;
- }
+ SkBitmap bitmap; + int loop = 0; + while (++loop) { + SkDebugf("attempt %d\n", loop); + if (!bitmap.tryAllocPixelsFlags(SkImageInfo::MakeN32(100000, 100000, kOpaque_SkAlphaType), + SkBitmap::kZeroPixels_AllocFlag)) { + SkDebugf("failed!\n"); + break; + } } #StdOut -attempt 1
+attempt 1 failed! ## ## @@ -1685,16 +1685,16 @@ Text is drawn on a transparent background; drawing the bitmap a second time lets the first draw show through. ## ###^ -SkBitmap bitmap;
-bitmap.allocPixelsFlags(SkImageInfo::MakeN32(44, 16, kPremul_SkAlphaType),
- SkBitmap::kZeroPixels_AllocFlag);
-SkCanvas offscreen(bitmap);
-SkPaint paint;
-offscreen.drawString("!@#$%", 0, 12, paint);
-canvas->scale(6, 6);
-canvas->drawBitmap(bitmap, 0, 0);
-canvas->drawBitmap(bitmap, 8, 8);
-^^^#
+SkBitmap bitmap; +bitmap.allocPixelsFlags(SkImageInfo::MakeN32(44, 16, kPremul_SkAlphaType), + SkBitmap::kZeroPixels_AllocFlag); +SkCanvas offscreen(bitmap); +SkPaint paint; +offscreen.drawString("!@#$%", 0, 12, paint); +canvas->scale(6, 6); +canvas->drawBitmap(bitmap, 0, 0); +canvas->drawBitmap(bitmap, 8, 8); +^^^# ## #SeeAlso tryAllocPixelsFlags allocPixels SkMallocPixelRef::MakeZeroed @@ -1732,15 +1732,15 @@ implementation of malloc(). #Example #Image 3 -SkBitmap bitmap;
-SkImageInfo info = SkImageInfo::Make(64, 256, kGray_8_SkColorType, kOpaque_SkAlphaType);
-if (bitmap.tryAllocPixels(info, 0)) {
- SkCanvas offscreen(bitmap);
- offscreen.scale(.5f, .5f);
- for (int x : { 0, 64, 128, 192 } ) {
- offscreen.drawBitmap(source, -x, 0);
- canvas->drawBitmap(bitmap, x, 0);
- }
+SkBitmap bitmap; +SkImageInfo info = SkImageInfo::Make(64, 256, kGray_8_SkColorType, kOpaque_SkAlphaType); +if (bitmap.tryAllocPixels(info, 0)) { + SkCanvas offscreen(bitmap); + offscreen.scale(.5f, .5f); + for (int x : { 0, 64, 128, 192 } ) { + offscreen.drawBitmap(source, -x, 0); + canvas->drawBitmap(bitmap, x, 0); + } } ## @@ -1770,14 +1770,14 @@ implementation of malloc(). #Example #Image 3 -SkBitmap bitmap;
-SkImageInfo info = SkImageInfo::Make(256, 64, kGray_8_SkColorType, kOpaque_SkAlphaType);
-bitmap.allocPixels(info, info.width() * info.bytesPerPixel() + 64);
-SkCanvas offscreen(bitmap);
-offscreen.scale(.5f, .5f);
-for (int y : { 0, 64, 128, 192 } ) {
- offscreen.drawBitmap(source, 0, -y);
- canvas->drawBitmap(bitmap, 0, y);
+SkBitmap bitmap; +SkImageInfo info = SkImageInfo::Make(256, 64, kGray_8_SkColorType, kOpaque_SkAlphaType); +bitmap.allocPixels(info, info.width() * info.bytesPerPixel() + 64); +SkCanvas offscreen(bitmap); +offscreen.scale(.5f, .5f); +for (int y : { 0, 64, 128, 192 } ) { + offscreen.drawBitmap(source, 0, -y); + canvas->drawBitmap(bitmap, 0, y); } ## @@ -1806,14 +1806,14 @@ implementation of malloc(). #Example #Image 3 -SkBitmap bitmap;
-if (bitmap.tryAllocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType))) {
- SkCanvas offscreen(bitmap);
- offscreen.scale(.25f, .5f);
- for (int y : { 0, 64, 128, 192 } ) {
- offscreen.drawBitmap(source, -y, -y);
- canvas->drawBitmap(bitmap, y, y);
- }
+SkBitmap bitmap; +if (bitmap.tryAllocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType))) { + SkCanvas offscreen(bitmap); + offscreen.scale(.25f, .5f); + for (int y : { 0, 64, 128, 192 } ) { + offscreen.drawBitmap(source, -y, -y); + canvas->drawBitmap(bitmap, y, y); + } } ## @@ -1841,14 +1841,14 @@ implementation of malloc(). #Example #Image 4 -SkBitmap bitmap;
-bitmap.allocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType));
-SkCanvas offscreen(bitmap);
-offscreen.scale(.5f, .5f);
-for (int y : { 0, 64, 128, 192 } ) {
- offscreen.drawBitmap(source, -y, -y);
- canvas->drawBitmap(bitmap, y, y);
-}
+SkBitmap bitmap; +bitmap.allocPixels(SkImageInfo::Make(64, 64, kGray_8_SkColorType, kOpaque_SkAlphaType)); +SkCanvas offscreen(bitmap); +offscreen.scale(.5f, .5f); +for (int y : { 0, 64, 128, 192 } ) { + offscreen.drawBitmap(source, -y, -y); + canvas->drawBitmap(bitmap, y, y); +} ## #SeeAlso tryAllocPixels allocPixelsFlags SkMallocPixelRef::MakeAllocate @@ -1879,17 +1879,17 @@ to draw without converting its pixel format. #Example #Height 160 - SkBitmap bitmap;
- if (bitmap.tryAllocN32Pixels(80, 80)) {
- bitmap.eraseColor(SK_ColorTRANSPARENT);
- bitmap.erase(0x7f3f7fff, SkIRect::MakeWH(50, 30));
- bitmap.erase(0x3f7fff3f, SkIRect::MakeXYWH(20, 10, 50, 30));
- bitmap.erase(0x5fff3f7f, SkIRect::MakeXYWH(40, 20, 50, 30));
- canvas->drawBitmap(bitmap, 0, 0);
- for (int x : { 0, 30, 60, 90 } ) {
- canvas->drawBitmap(bitmap, x, 70);
- }
- }
+ SkBitmap bitmap; + if (bitmap.tryAllocN32Pixels(80, 80)) { + bitmap.eraseColor(SK_ColorTRANSPARENT); + bitmap.erase(0x7f3f7fff, SkIRect::MakeWH(50, 30)); + bitmap.erase(0x3f7fff3f, SkIRect::MakeXYWH(20, 10, 50, 30)); + bitmap.erase(0x5fff3f7f, SkIRect::MakeXYWH(40, 20, 50, 30)); + canvas->drawBitmap(bitmap, 0, 0); + for (int x : { 0, 30, 60, 90 } ) { + canvas->drawBitmap(bitmap, x, 70); + } + } ## #SeeAlso tryAllocPixels allocN32Pixels SkMallocPixelRef::MakeAllocate @@ -1916,21 +1916,21 @@ to draw without converting its pixel format. #Param isOpaque true if pixels do not have transparency ## #Example - SkRandom random;
- SkBitmap bitmap;
- bitmap.allocN32Pixels(64, 64);
- bitmap.eraseColor(SK_ColorTRANSPARENT);
- for (int y = 0; y < 256; y += 64) {
- for (int x = 0; x < 256; x += 64) {
- SkColor color = random.nextU();
- uint32_t w = random.nextRangeU(4, 32);
- uint32_t cx = random.nextRangeU(0, 64 - w);
- uint32_t h = random.nextRangeU(4, 32);
- uint32_t cy = random.nextRangeU(0, 64 - h);
- bitmap.erase(color, SkIRect::MakeXYWH(cx, cy, w, h));
- canvas->drawBitmap(bitmap, x, y);
- }
- }
+ SkRandom random; + SkBitmap bitmap; + bitmap.allocN32Pixels(64, 64); + bitmap.eraseColor(SK_ColorTRANSPARENT); + for (int y = 0; y < 256; y += 64) { + for (int x = 0; x < 256; x += 64) { + SkColor color = random.nextU(); + uint32_t w = random.nextRangeU(4, 32); + uint32_t cx = random.nextRangeU(0, 64 - w); + uint32_t h = random.nextRangeU(4, 32); + uint32_t cy = random.nextRangeU(0, 64 - h); + bitmap.erase(color, SkIRect::MakeXYWH(cx, cy, w, h)); + canvas->drawBitmap(bitmap, x, y); + } + } ## #SeeAlso allocPixels tryAllocN32Pixels SkMallocPixelRef::MakeAllocate @@ -1970,24 +1970,24 @@ as parameters. releaseProc is called immediately because rowBytes is too small for Pixel_Ref. ## #Function -static void releaseProc(void* addr, void* ) {
- SkDebugf("releaseProc called\n");
- delete[] (uint32_t*) addr;
-}
-
-##
-
-void draw(SkCanvas* canvas) {
- SkBitmap bitmap;
- void* pixels = new uint32_t[8 * 8];
- SkImageInfo info = SkImageInfo::MakeN32(8, 8, kOpaque_SkAlphaType);
- SkDebugf("before installPixels\n");
- bool installed = bitmap.installPixels(info, pixels, 16, releaseProc, nullptr);
- SkDebugf("install " "%s" "successful\n", installed ? "" : "not ");
+static void releaseProc(void* addr, void* ) { + SkDebugf("releaseProc called\n"); + delete[] (uint32_t*) addr; +} + +## + +void draw(SkCanvas* canvas) { + SkBitmap bitmap; + void* pixels = new uint32_t[8 * 8]; + SkImageInfo info = SkImageInfo::MakeN32(8, 8, kOpaque_SkAlphaType); + SkDebugf("before installPixels\n"); + bool installed = bitmap.installPixels(info, pixels, 16, releaseProc, nullptr); + SkDebugf("install " "%s" "successful\n", installed ? "" : "not "); } #StdOut -before installPixels
-releaseProc called
+before installPixels +releaseProc called install not successful ## ## @@ -2021,20 +2021,20 @@ Caller must ensure that pixels are valid for the lifetime of Bitmap and Pixel_Re #Bug 7079 ## GPU does not support kUnpremul_SkAlphaType, does not assert that it does not. ## -void draw(SkCanvas* canvas) {
- SkRandom random;
- SkBitmap bitmap;
- const int width = 8;
- const int height = 8;
- uint32_t pixels[width * height];
- for (unsigned x = 0; x < width * height; ++x) {
- pixels[x] = random.nextU();
- }
- SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType);
- if (bitmap.installPixels(info, pixels, info.minRowBytes())) {
- canvas->scale(32, 32);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+void draw(SkCanvas* canvas) { + SkRandom random; + SkBitmap bitmap; + const int width = 8; + const int height = 8; + uint32_t pixels[width * height]; + for (unsigned x = 0; x < width * height; ++x) { + pixels[x] = random.nextU(); + } + SkImageInfo info = SkImageInfo::MakeN32(width, height, kUnpremul_SkAlphaType); + if (bitmap.installPixels(info, pixels, info.minRowBytes())) { + canvas->scale(32, 32); + canvas->drawBitmap(bitmap, 0, 0); + } } ## @@ -2107,22 +2107,22 @@ Caller must ensure that mask is valid for the lifetime of Bitmap and Pixel_Ref. Draw a five by five bitmap, and draw it again with a center white pixel. ## #Height 64 - uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },
- { 0xAC, 0xA8, 0x89, 0x47, 0x87 },
- { 0x4B, 0x25, 0x25, 0x25, 0x46 },
- { 0x90, 0x81, 0x25, 0x41, 0x33 },
- { 0x75, 0x55, 0x44, 0x20, 0x00 }};
- SkMask mask;
- mask.fImage = storage[0];
- mask.fBounds = SkIRect::MakeWH(5, 5);
- mask.fRowBytes = 5;
- mask.fFormat = SkMask::kA8_Format;
- SkBitmap bitmap;
- bitmap.installMaskPixels(mask);
- canvas->scale(10, 10);
- canvas->drawBitmap(bitmap, 0, 0);
- storage[2][2] = 0xFF;
- bitmap.installMaskPixels(mask);
+ uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 }, + { 0xAC, 0xA8, 0x89, 0x47, 0x87 }, + { 0x4B, 0x25, 0x25, 0x25, 0x46 }, + { 0x90, 0x81, 0x25, 0x41, 0x33 }, + { 0x75, 0x55, 0x44, 0x20, 0x00 }}; + SkMask mask; + mask.fImage = storage[0]; + mask.fBounds = SkIRect::MakeWH(5, 5); + mask.fRowBytes = 5; + mask.fFormat = SkMask::kA8_Format; + SkBitmap bitmap; + bitmap.installMaskPixels(mask); + canvas->scale(10, 10); + canvas->drawBitmap(bitmap, 0, 0); + storage[2][2] = 0xFF; + bitmap.installMaskPixels(mask); canvas->drawBitmap(bitmap, 10, 0); ## @@ -2147,14 +2147,14 @@ of Bitmap and Pixel_Ref. #Example #Height 50 - uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
- uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 };
- SkBitmap bitmap;
- bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
- canvas->scale(10, 50);
- canvas->drawBitmap(bitmap, 0, 0);
- bitmap.setPixels(set2);
- canvas->drawBitmap(bitmap, 10, 0);
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 }; + uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 }; + SkBitmap bitmap; + bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5); + canvas->scale(10, 50); + canvas->drawBitmap(bitmap, 0, 0); + bitmap.setPixels(set2); + canvas->drawBitmap(bitmap, 10, 0); ## #SeeAlso installPixels allocPixels @@ -2181,17 +2181,17 @@ Bitmap hosts and draws gray values in set1. tryAllocPixels replaces Pixel_Ref and erases it to black, but does not alter set1. setPixels replaces black Pixel_Ref with set1. ## - uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
- SkBitmap bitmap;
- bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
- canvas->scale(10, 50);
- canvas->drawBitmap(bitmap, 0, 0);
- if (bitmap.tryAllocPixels()) {
- bitmap.eraseColor(SK_ColorBLACK);
- canvas->drawBitmap(bitmap, 8, 0);
- bitmap.setPixels(set1);
- canvas->drawBitmap(bitmap, 16, 0);
- }
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 }; + SkBitmap bitmap; + bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5); + canvas->scale(10, 50); + canvas->drawBitmap(bitmap, 0, 0); + if (bitmap.tryAllocPixels()) { + bitmap.eraseColor(SK_ColorBLACK); + canvas->drawBitmap(bitmap, 8, 0); + bitmap.setPixels(set1); + canvas->drawBitmap(bitmap, 16, 0); + } ## #SeeAlso allocPixels installPixels setPixels @@ -2216,16 +2216,16 @@ Bitmap hosts and draws gray values in set1. allocPixels replaces Pixel_Ref and erases it to black, but does not alter set1. setPixels replaces black Pixel_Ref with set2. ## - uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 };
- uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 };
- SkBitmap bitmap;
- bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5);
- canvas->scale(10, 50);
- canvas->drawBitmap(bitmap, 0, 0);
- bitmap.allocPixels();
- bitmap.eraseColor(SK_ColorBLACK);
- canvas->drawBitmap(bitmap, 8, 0);
- bitmap.setPixels(set2);
+ uint8_t set1[5] = { 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 }; + uint8_t set2[5] = { 0xAC, 0xA8, 0x89, 0x47, 0x87 }; + SkBitmap bitmap; + bitmap.installPixels(SkImageInfo::Make(5, 1, kGray_8_SkColorType, kOpaque_SkAlphaType), set1, 5); + canvas->scale(10, 50); + canvas->drawBitmap(bitmap, 0, 0); + bitmap.allocPixels(); + bitmap.eraseColor(SK_ColorBLACK); + canvas->drawBitmap(bitmap, 8, 0); + bitmap.setPixels(set2); canvas->drawBitmap(bitmap, 16, 0); ## @@ -2292,13 +2292,13 @@ public: void draw(SkCanvas* canvas) { LargeAllocator largeAllocator; SkBitmap bitmap; - int width = 100; // make this 20000
- int height = 100; // and this 100000 to allocate 8 gigs on a 64-bit platform
- bitmap.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType));
- if (bitmap.tryAllocPixels(&largeAllocator)) {
- bitmap.eraseColor(0xff55aa33);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+ int width = 100; // make this 20000 + int height = 100; // and this 100000 to allocate 8 gigs on a 64-bit platform + bitmap.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType)); + if (bitmap.tryAllocPixels(&largeAllocator)) { + bitmap.eraseColor(0xff55aa33); + canvas->drawBitmap(bitmap, 0, 0); + } } ## @@ -2344,13 +2344,13 @@ public: void draw(SkCanvas* canvas) { TinyAllocator tinyAllocator; SkBitmap bitmap; - bitmap.setInfo(SkImageInfo::MakeN32(2, 2, kOpaque_SkAlphaType));
- if (bitmap.tryAllocPixels(&tinyAllocator)) {
- bitmap.eraseColor(0xff55aa33);
- bitmap.erase(0xffaa3355, SkIRect::MakeXYWH(1, 1, 1, 1));
- canvas->scale(16, 16);
- canvas->drawBitmap(bitmap, 0, 0);
- }
+ bitmap.setInfo(SkImageInfo::MakeN32(2, 2, kOpaque_SkAlphaType)); + if (bitmap.tryAllocPixels(&tinyAllocator)) { + bitmap.eraseColor(0xff55aa33); + bitmap.erase(0xffaa3355, SkIRect::MakeXYWH(1, 1, 1, 1)); + canvas->scale(16, 16); + canvas->drawBitmap(bitmap, 0, 0); + } } ## @@ -2371,11 +2371,11 @@ If Pixel_Ref has not been set, returns nullptr. #Example #Image 3 - SkBitmap subset;
- source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256));
- SkDebugf("src ref %c= sub ref\n", source.pixelRef() == subset.pixelRef() ? '=' : '!');
- SkDebugf("src pixels %c= sub pixels\n", source.getPixels() == subset.getPixels() ? '=' : '!');
- SkDebugf("src addr %c= sub addr\n", source.getAddr(32, 64) == subset.getAddr(0, 0) ? '=' : '!');
+ SkBitmap subset; + source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256)); + SkDebugf("src ref %c= sub ref\n", source.pixelRef() == subset.pixelRef() ? '=' : '!'); + SkDebugf("src pixels %c= sub pixels\n", source.getPixels() == subset.getPixels() ? '=' : '!'); + SkDebugf("src addr %c= sub addr\n", source.getAddr(32, 64) == subset.getAddr(0, 0) ? '=' : '!'); ## #SeeAlso getPixels getAddr @@ -2399,16 +2399,16 @@ Returns (0, 0) if Pixel_Ref is nullptr. #Example #Image 3 - SkBitmap subset;
- source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256));
- SkIPoint sourceOrigin = source.pixelRefOrigin();
- SkIPoint subsetOrigin = subset.pixelRefOrigin();
- SkDebugf("source origin: %d, %d\n", sourceOrigin.fX, sourceOrigin.fY);
- SkDebugf("subset origin: %d, %d\n", subsetOrigin.fX, subsetOrigin.fY);
-#StdOut
-source origin: 0, 0
-subset origin: 32, 64
-##
+ SkBitmap subset; + source.extractSubset(&subset, SkIRect::MakeXYWH(32, 64, 128, 256)); + SkIPoint sourceOrigin = source.pixelRefOrigin(); + SkIPoint subsetOrigin = subset.pixelRefOrigin(); + SkDebugf("source origin: %d, %d\n", sourceOrigin.fX, sourceOrigin.fY); + SkDebugf("subset origin: %d, %d\n", subsetOrigin.fX, subsetOrigin.fY); +#StdOut +source origin: 0, 0 +subset origin: 32, 64 +## ## #ToDo incomplete ## @@ -2438,11 +2438,11 @@ Color_Type and Alpha_Type in Image_Info. #Description Treating 32 bit data as 8 bit data is unlikely to produce useful results. ## - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(source.width() - 5, source.height() - 5,
- kGray_8_SkColorType, kOpaque_SkAlphaType), source.rowBytes());
- bitmap.setPixelRef(sk_ref_sp(source.pixelRef()), 5, 5);
- canvas->drawBitmap(bitmap, 10, 10);
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(source.width() - 5, source.height() - 5, + kGray_8_SkColorType, kOpaque_SkAlphaType), source.rowBytes()); + bitmap.setPixelRef(sk_ref_sp(source.pixelRef()), 5, 5); + canvas->drawBitmap(bitmap, 10, 10); ## #SeeAlso setInfo @@ -2460,9 +2460,9 @@ Returns true if Bitmap is can be drawn. #Example #Image 5 #Height 160 - if (source.readyToDraw()) {
- canvas->drawBitmap(source, 10, 10);
- }
+ if (source.readyToDraw()) { + canvas->drawBitmap(source, 10, 10); + } ## #SeeAlso getPixels drawsNothing @@ -2482,16 +2482,16 @@ Determines if pixels have changed since last examined. #Return unique value for pixels in Pixel_Ref ## #Example - SkBitmap bitmap;
- SkDebugf("empty id %u\n", bitmap.getGenerationID());
- bitmap.allocPixels(SkImageInfo::MakeN32(64, 64, kOpaque_SkAlphaType));
- SkDebugf("alloc id %u\n", bitmap.getGenerationID());
- bitmap.eraseColor(SK_ColorRED);
+ SkBitmap bitmap; + SkDebugf("empty id %u\n", bitmap.getGenerationID()); + bitmap.allocPixels(SkImageInfo::MakeN32(64, 64, kOpaque_SkAlphaType)); + SkDebugf("alloc id %u\n", bitmap.getGenerationID()); + bitmap.eraseColor(SK_ColorRED); SkDebugf("erase id %u\n", bitmap.getGenerationID()); #StdOut #Volatile -empty id 0
-alloc id 4
+empty id 0 +alloc id 4 erase id 6 ## ## @@ -2509,17 +2509,17 @@ getGenerationID() return a different value. #Example #Height 20 - SkBitmap bitmap;
- bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
- bitmap.allocPixels();
- bitmap.eraseColor(SK_ColorRED);
- canvas->scale(16, 16);
- canvas->drawBitmap(bitmap, 0, 0);
- *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE);
- canvas->drawBitmap(bitmap, 2, 0);
- bitmap.notifyPixelsChanged();
- *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN);
- canvas->drawBitmap(bitmap, 4, 0);
+ SkBitmap bitmap; + bitmap.setInfo(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); + bitmap.allocPixels(); + bitmap.eraseColor(SK_ColorRED); + canvas->scale(16, 16); + canvas->drawBitmap(bitmap, 0, 0); + *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorBLUE); + canvas->drawBitmap(bitmap, 2, 0); + bitmap.notifyPixelsChanged(); + *(SkPMColor*) bitmap.getPixels() = SkPreMultiplyColor(SK_ColorGREEN); + canvas->drawBitmap(bitmap, 4, 0); ## #SeeAlso getGenerationID isVolatile Pixel_Ref @@ -2539,11 +2539,11 @@ then Color_RGB is ignored. #Example #Height 20 - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kOpaque_SkAlphaType));
- bitmap.eraseColor(SK_ColorRED);
- canvas->scale(16, 16);
- canvas->drawBitmap(bitmap, 0, 0);
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kOpaque_SkAlphaType)); + bitmap.eraseColor(SK_ColorRED); + canvas->scale(16, 16); + canvas->drawBitmap(bitmap, 0, 0); ## #SeeAlso eraseARGB eraseRGB erase @@ -2567,12 +2567,12 @@ then r, g, and b are ignored. #Example #Height 80 - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType));
- bitmap.eraseARGB(0x7f, 0xff, 0x7f, 0x3f);
- canvas->scale(50, 50);
- canvas->drawBitmap(bitmap, 0, 0);
- canvas->drawBitmap(bitmap, .5f, .5f);
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType)); + bitmap.eraseARGB(0x7f, 0xff, 0x7f, 0x3f); + canvas->scale(50, 50); + canvas->drawBitmap(bitmap, 0, 0); + canvas->drawBitmap(bitmap, .5f, .5f); ## #SeeAlso eraseColor eraseRGB erase @@ -2593,12 +2593,12 @@ If colorType is kAlpha_8_SkColorType, all pixels are set to 255. #Example #Height 80 - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType));
- bitmap.eraseRGB(0xff, 0x7f, 0x3f);
- canvas->scale(50, 50);
- canvas->drawBitmap(bitmap, 0, 0);
- canvas->drawBitmap(bitmap, .5f, .5f);
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType)); + bitmap.eraseRGB(0xff, 0x7f, 0x3f); + canvas->scale(50, 50); + canvas->drawBitmap(bitmap, 0, 0); + canvas->drawBitmap(bitmap, .5f, .5f); ## #SeeAlso eraseColor eraseARGB erase @@ -2621,15 +2621,15 @@ then Color_RGB is ignored. #Example #Height 70 - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32(2, 2, kPremul_SkAlphaType));
- bitmap.erase(0x7fff7f3f, SkIRect::MakeWH(1, 1));
- bitmap.erase(0x7f7f3fff, SkIRect::MakeXYWH(0, 1, 1, 1));
- bitmap.erase(0x7f3fff7f, SkIRect::MakeXYWH(1, 0, 1, 1));
- bitmap.erase(0x7f1fbf5f, SkIRect::MakeXYWH(1, 1, 1, 1));
- canvas->scale(25, 25);
- canvas->drawBitmap(bitmap, 0, 0);
- canvas->drawBitmap(bitmap, .5f, .5f);
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32(2, 2, kPremul_SkAlphaType)); + bitmap.erase(0x7fff7f3f, SkIRect::MakeWH(1, 1)); + bitmap.erase(0x7f7f3fff, SkIRect::MakeXYWH(0, 1, 1, 1)); + bitmap.erase(0x7f3fff7f, SkIRect::MakeXYWH(1, 0, 1, 1)); + bitmap.erase(0x7f1fbf5f, SkIRect::MakeXYWH(1, 1, 1, 1)); + canvas->scale(25, 25); + canvas->drawBitmap(bitmap, 0, 0); + canvas->drawBitmap(bitmap, .5f, .5f); ## @@ -2733,12 +2733,12 @@ one of: getAddr8, getAddr16, or getAddr32. #Example #Image 3 - char* row0 = (char* ) source.getAddr(0, 0);
- char* row1 = (char* ) source.getAddr(0, 1);
- SkDebugf("addr interval %c= rowBytes\n", row1 - row0 == source.rowBytes() ? '=' : '!');
-#StdOut
-addr interval == rowBytes
-##
+ char* row0 = (char* ) source.getAddr(0, 0); + char* row1 = (char* ) source.getAddr(0, 1); + SkDebugf("addr interval %c= rowBytes\n", row1 - row0 == source.rowBytes() ? '=' : '!'); +#StdOut +addr interval == rowBytes +## ## #SeeAlso getAddr8 getAddr16 getAddr32 readPixels SkPixmap::addr @@ -2766,13 +2766,13 @@ Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: #Example #Image 3 - uint32_t* row0 = source.getAddr32(0, 0);
- uint32_t* row1 = source.getAddr32(0, 1);
- size_t interval = (row1 - row0) * source.bytesPerPixel();
- SkDebugf("addr interval %c= rowBytes\n", interval == source.rowBytes() ? '=' : '!');
-#StdOut
-addr interval == rowBytes
-##
+ uint32_t* row0 = source.getAddr32(0, 0); + uint32_t* row1 = source.getAddr32(0, 1); + size_t interval = (row1 - row0) * source.bytesPerPixel(); + SkDebugf("addr interval %c= rowBytes\n", interval == source.rowBytes() ? '=' : '!'); +#StdOut +addr interval == rowBytes +## ## #SeeAlso getAddr8 getAddr16 getAddr readPixels SkPixmap::addr32 @@ -2800,19 +2800,19 @@ Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: #Example #Image 3 - SkBitmap bitmap16;
- SkImageInfo dstInfo = SkImageInfo::Make(source.width(), source.height(), kARGB_4444_SkColorType,
- kPremul_SkAlphaType);
- bitmap16.allocPixels(dstInfo);
- if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) {
- uint16_t* row0 = bitmap16.getAddr16(0, 0);
- uint16_t* row1 = bitmap16.getAddr16(0, 1);
- size_t interval = (row1 - row0) * bitmap16.bytesPerPixel();
- SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!');
- }
-#StdOut
-addr interval == rowBytes
-##
+ SkBitmap bitmap16; + SkImageInfo dstInfo = SkImageInfo::Make(source.width(), source.height(), kARGB_4444_SkColorType, + kPremul_SkAlphaType); + bitmap16.allocPixels(dstInfo); + if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) { + uint16_t* row0 = bitmap16.getAddr16(0, 0); + uint16_t* row1 = bitmap16.getAddr16(0, 1); + size_t interval = (row1 - row0) * bitmap16.bytesPerPixel(); + SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!'); + } +#StdOut +addr interval == rowBytes +## ## #SeeAlso getAddr8 getAddr getAddr32 readPixels SkPixmap::addr16 @@ -2839,15 +2839,15 @@ Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: #Return unsigned 8-bit pointer to pixel at (x, y) ## #Example - SkBitmap bitmap;
- const int width = 8;
- const int height = 8;
- uint8_t pixels[height][width];
- SkImageInfo info = SkImageInfo::Make(width, height, kGray_8_SkColorType, kOpaque_SkAlphaType);
- if (bitmap.installPixels(info, pixels, info.minRowBytes())) {
- SkDebugf("&pixels[4][2] %c= bitmap.getAddr8(2, 4)\n",
- &pixels[4][2] == bitmap.getAddr8(2, 4) ? '=' : '!');
- }
+ SkBitmap bitmap; + const int width = 8; + const int height = 8; + uint8_t pixels[height][width]; + SkImageInfo info = SkImageInfo::Make(width, height, kGray_8_SkColorType, kOpaque_SkAlphaType); + if (bitmap.installPixels(info, pixels, info.minRowBytes())) { + SkDebugf("&pixels[4][2] %c= bitmap.getAddr8(2, 4)\n", + &pixels[4][2] == bitmap.getAddr8(2, 4) ? '=' : '!'); + } #StdOut &pixels[4][2] == bitmap.getAddr8(2, 4) ## @@ -2886,36 +2886,36 @@ Return false if: #Example #Image 3 - SkIRect bounds, s;
- source.getBounds(&bounds);
- SkDebugf("bounds: %d, %d, %d, %d\n", bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
- SkBitmap subset;
- for (int left: { -100, 0, 100, 1000 } ) {
- for (int right: { 0, 100, 1000 } ) {
- SkIRect b = SkIRect::MakeLTRB(left, 100, right, 200);
- bool success = source.extractSubset(&subset, b);
- SkDebugf("subset: %4d, %4d, %4d, %4d ", b.fLeft, b.fTop, b.fRight, b.fBottom);
- SkDebugf("success; %s", success ? "true" : "false");
- if (success) {
- subset.getBounds(&s);
- SkDebugf(" subset: %d, %d, %d, %d", s.fLeft, s.fTop, s.fRight, s.fBottom);
- }
- SkDebugf("\n");
- }
- }
+ SkIRect bounds, s; + source.getBounds(&bounds); + SkDebugf("bounds: %d, %d, %d, %d\n", bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom); + SkBitmap subset; + for (int left: { -100, 0, 100, 1000 } ) { + for (int right: { 0, 100, 1000 } ) { + SkIRect b = SkIRect::MakeLTRB(left, 100, right, 200); + bool success = source.extractSubset(&subset, b); + SkDebugf("subset: %4d, %4d, %4d, %4d ", b.fLeft, b.fTop, b.fRight, b.fBottom); + SkDebugf("success; %s", success ? "true" : "false"); + if (success) { + subset.getBounds(&s); + SkDebugf(" subset: %d, %d, %d, %d", s.fLeft, s.fTop, s.fRight, s.fBottom); + } + SkDebugf("\n"); + } + } #StdOut -bounds: 0, 0, 512, 512
-subset: -100, 100, 0, 200 success; false
-subset: -100, 100, 100, 200 success; true subset: 0, 0, 100, 100
-subset: -100, 100, 1000, 200 success; true subset: 0, 0, 512, 100
-subset: 0, 100, 0, 200 success; false
-subset: 0, 100, 100, 200 success; true subset: 0, 0, 100, 100
-subset: 0, 100, 1000, 200 success; true subset: 0, 0, 512, 100
-subset: 100, 100, 0, 200 success; false
-subset: 100, 100, 100, 200 success; false
-subset: 100, 100, 1000, 200 success; true subset: 0, 0, 412, 100
-subset: 1000, 100, 0, 200 success; false
-subset: 1000, 100, 100, 200 success; false
+bounds: 0, 0, 512, 512 +subset: -100, 100, 0, 200 success; false +subset: -100, 100, 100, 200 success; true subset: 0, 0, 100, 100 +subset: -100, 100, 1000, 200 success; true subset: 0, 0, 512, 100 +subset: 0, 100, 0, 200 success; false +subset: 0, 100, 100, 200 success; true subset: 0, 0, 100, 100 +subset: 0, 100, 1000, 200 success; true subset: 0, 0, 512, 100 +subset: 100, 100, 0, 200 success; false +subset: 100, 100, 100, 200 success; false +subset: 100, 100, 1000, 200 success; true subset: 0, 0, 412, 100 +subset: 1000, 100, 0, 200 success; false +subset: 1000, 100, 100, 200 success; false subset: 1000, 100, 1000, 200 success; false ## ## @@ -2978,29 +2978,29 @@ pixels are treated as if they are linear, regardless of how they are encoded. #Example #Height 64 void draw(SkCanvas* canvas) { - const int width = 256;
- const int height = 32;
- std::vector<int32_t> dstPixels;
- dstPixels.resize(height * width * 4);
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
- SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
- SkPaint gradPaint;
- gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
- SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
- for (auto behavior : { SkTransferFunctionBehavior::kRespect,
- SkTransferFunctionBehavior::kIgnore} ) {
- SkBitmap bitmap;
- bitmap.allocPixels(info);
- SkCanvas srcCanvas(bitmap);
- srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint);
- if (bitmap.readPixels(info, &dstPixels.front(), width * 4, 0, 0, behavior)) {
- SkPixmap dstPixmap(info, &dstPixels.front(), width * 4);
- bitmap.installPixels(dstPixmap);
- canvas->drawBitmap(bitmap, 0, 0);
- }
- canvas->translate(0, height);
- }
+ const int width = 256; + const int height = 32; + std::vector<int32_t> dstPixels; + dstPixels.resize(height * width * 4); + SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); + SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 }; + SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } }; + SkPaint gradPaint; + gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr, + SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode)); + for (auto behavior : { SkTransferFunctionBehavior::kRespect, + SkTransferFunctionBehavior::kIgnore} ) { + SkBitmap bitmap; + bitmap.allocPixels(info); + SkCanvas srcCanvas(bitmap); + srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint); + if (bitmap.readPixels(info, &dstPixels.front(), width * 4, 0, 0, behavior)) { + SkPixmap dstPixmap(info, &dstPixels.front(), width * 4); + bitmap.installPixels(dstPixmap); + canvas->drawBitmap(bitmap, 0, 0); + } + canvas->translate(0, height); + } } ## @@ -3057,25 +3057,25 @@ abs(srcY) >= this->height() Transferring the gradient from 8 bits per component to 4 bits per component creates visible banding. ## - const int width = 256;
- const int height = 64;
- SkImageInfo srcInfo = SkImageInfo::MakeN32Premul(width, height);
- SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
- SkPoint gradPoints[] = { { 0, 0 }, { 256, 0 } };
- SkPaint paint;
- paint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
- SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
- SkBitmap bitmap;
- bitmap.allocPixels(srcInfo);
- SkCanvas srcCanvas(bitmap);
- srcCanvas.drawRect(SkRect::MakeWH(width, height), paint);
- canvas->drawBitmap(bitmap, 0, 0);
- SkImageInfo dstInfo = srcInfo.makeColorType(kARGB_4444_SkColorType);
- std::vector<int16_t> dstPixels;
- dstPixels.resize(height * width);
- bitmap.readPixels(dstInfo, &dstPixels.front(), width * 2, 0, 0);
- SkPixmap dstPixmap(dstInfo, &dstPixels.front(), width * 2);
- bitmap.installPixels(dstPixmap);
+ const int width = 256; + const int height = 64; + SkImageInfo srcInfo = SkImageInfo::MakeN32Premul(width, height); + SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 }; + SkPoint gradPoints[] = { { 0, 0 }, { 256, 0 } }; + SkPaint paint; + paint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr, + SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode)); + SkBitmap bitmap; + bitmap.allocPixels(srcInfo); + SkCanvas srcCanvas(bitmap); + srcCanvas.drawRect(SkRect::MakeWH(width, height), paint); + canvas->drawBitmap(bitmap, 0, 0); + SkImageInfo dstInfo = srcInfo.makeColorType(kARGB_4444_SkColorType); + std::vector<int16_t> dstPixels; + dstPixels.resize(height * width); + bitmap.readPixels(dstInfo, &dstPixels.front(), width * 2, 0, 0); + SkPixmap dstPixmap(dstInfo, &dstPixels.front(), width * 2); + bitmap.installPixels(dstPixmap); canvas->drawBitmap(bitmap, 0, 64); ## @@ -3125,20 +3125,20 @@ abs(srcY) >= this->height() #Example #Image 3 - std::vector<int32_t> srcPixels;
- srcPixels.resize(source.height() * source.rowBytes());
- for (int y = 0; y < 4; ++y) {
- for (int x = 0; x < 4; ++x) {
- SkPixmap pixmap(SkImageInfo::MakeN32Premul(source.width() / 4, source.height() / 4),
- &srcPixels.front() + x * source.height() * source.width() / 4 +
- y * source.width() / 4, source.rowBytes());
- source.readPixels(pixmap, x * source.width() / 4, y * source.height() / 4);
- }
- }
- canvas->scale(.5f, .5f);
- SkBitmap bitmap;
- bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width(), source.height()),
- &srcPixels.front(), source.rowBytes());
+ std::vector<int32_t> srcPixels; + srcPixels.resize(source.height() * source.rowBytes()); + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + SkPixmap pixmap(SkImageInfo::MakeN32Premul(source.width() / 4, source.height() / 4), + &srcPixels.front() + x * source.height() * source.width() / 4 + + y * source.width() / 4, source.rowBytes()); + source.readPixels(pixmap, x * source.width() / 4, y * source.height() / 4); + } + } + canvas->scale(.5f, .5f); + SkBitmap bitmap; + bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width(), source.height()), + &srcPixels.front(), source.rowBytes()); canvas->drawBitmap(bitmap, 0, 0); ## @@ -3176,19 +3176,19 @@ false if pixel conversion is not possible. #Example #Height 128 #Image 3 - std::vector<int32_t> srcPixels;
- srcPixels.resize(source.height() * source.width() * 8);
- for (int i = 0; i < 2; ++i) {
- SkPixmap pixmap(SkImageInfo::Make(source.width() * 2, source.height(),
- i ? kRGBA_8888_SkColorType : kBGRA_8888_SkColorType, kPremul_SkAlphaType),
- &srcPixels.front() + i * source.width(), source.rowBytes() * 2);
- source.readPixels(pixmap);
- }
- canvas->scale(.25f, .25f);
- SkBitmap bitmap;
- bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width() * 2, source.height()),
- &srcPixels.front(), source.rowBytes() * 2);
- canvas->drawBitmap(bitmap, 0, 0);
+ std::vector<int32_t> srcPixels; + srcPixels.resize(source.height() * source.width() * 8); + for (int i = 0; i < 2; ++i) { + SkPixmap pixmap(SkImageInfo::Make(source.width() * 2, source.height(), + i ? kRGBA_8888_SkColorType : kBGRA_8888_SkColorType, kPremul_SkAlphaType), + &srcPixels.front() + i * source.width(), source.rowBytes() * 2); + source.readPixels(pixmap); + } + canvas->scale(.25f, .25f); + SkBitmap bitmap; + bitmap.installPixels(SkImageInfo::MakeN32Premul(source.width() * 2, source.height()), + &srcPixels.front(), source.rowBytes() * 2); + canvas->drawBitmap(bitmap, 0, 0); ## #SeeAlso writePixels SkPixmap::readPixels SkCanvas::readPixels SkImage::readPixels SkSurface::readPixels @@ -3237,23 +3237,23 @@ abs(dstY) >= this->height() #Example #Image 3 - std::vector<int32_t> srcPixels;
- int width = image->width();
- int height = image->height();
- srcPixels.resize(height * width * 4);
- SkPixmap pixmap(SkImageInfo::MakeN32Premul(width, height), (const void*) &srcPixels.front(),
- width * 4);
- image->readPixels(pixmap, 0, 0);
- canvas->scale(.5f, .5f);
- width /= 4;
- height /= 4;
- for (int y = 0; y < 4; ++y) {
- for (int x = 0; x < 4; ++x) {
- SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
- bitmap.writePixels(pixmap, -y * width, -x * height);
- canvas->drawBitmap(bitmap, x * width, y * height);
- }
+ std::vector<int32_t> srcPixels; + int width = image->width(); + int height = image->height(); + srcPixels.resize(height * width * 4); + SkPixmap pixmap(SkImageInfo::MakeN32Premul(width, height), (const void*) &srcPixels.front(), + width * 4); + image->readPixels(pixmap, 0, 0); + canvas->scale(.5f, .5f); + width /= 4; + height /= 4; + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); + bitmap.writePixels(pixmap, -y * width, -x * height); + canvas->drawBitmap(bitmap, x * width, y * height); + } } ## @@ -3290,14 +3290,14 @@ false if pixel conversion is not possible. #Example #Height 80 - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(2, 2));
- bitmap.eraseColor(SK_ColorGREEN);
- SkPMColor color = 0xFF5599BB;
- SkPixmap src(SkImageInfo::MakeN32Premul(1, 1), &color, 4);
- bitmap.writePixels(src);
- canvas->scale(40, 40);
- canvas->drawBitmap(bitmap, 0, 0);
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32Premul(2, 2)); + bitmap.eraseColor(SK_ColorGREEN); + SkPMColor color = 0xFF5599BB; + SkPixmap src(SkImageInfo::MakeN32Premul(1, 1), &color, 4); + bitmap.writePixels(src); + canvas->scale(40, 40); + canvas->drawBitmap(bitmap, 0, 0); ## #SeeAlso readPixels @@ -3344,27 +3344,27 @@ pixels are treated as if they are linear, regardless of how they are encoded. #Example #Height 64 - const int width = 256;
- const int height = 32;
- std::vector<int32_t> dstPixels;
- dstPixels.resize(height * width * 4);
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 };
- SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
- SkPaint gradPaint;
- gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
- SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
- for (auto behavior : { SkTransferFunctionBehavior::kRespect,
- SkTransferFunctionBehavior::kIgnore} ) {
- SkPixmap dstPixmap(info, &dstPixels.front(), width * 4);
- SkBitmap bitmap;
- bitmap.installPixels(dstPixmap);
- SkCanvas srcCanvas(bitmap);
- srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint);
- if (bitmap.writePixels(dstPixmap, 0, 0, behavior)) {
- canvas->drawBitmap(bitmap, 0, 0);
- }
- canvas->translate(0, height);
+ const int width = 256; + const int height = 32; + std::vector<int32_t> dstPixels; + dstPixels.resize(height * width * 4); + SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); + SkColor gradColors[] = { 0xFFAA3300, 0x7F881122 }; + SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } }; + SkPaint gradPaint; + gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr, + SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode)); + for (auto behavior : { SkTransferFunctionBehavior::kRespect, + SkTransferFunctionBehavior::kIgnore} ) { + SkPixmap dstPixmap(info, &dstPixels.front(), width * 4); + SkBitmap bitmap; + bitmap.installPixels(dstPixmap); + SkCanvas srcCanvas(bitmap); + srcCanvas.drawRect(SkRect::MakeWH(width, height), gradPaint); + if (bitmap.writePixels(dstPixmap, 0, 0, behavior)) { + canvas->drawBitmap(bitmap, 0, 0); + } + canvas->translate(0, height); } ## @@ -3421,20 +3421,20 @@ Uses HeapAllocator to reserve memory for dst Pixel_Ref. #Example #Height 100 - SkBitmap alpha, bitmap;
- bitmap.allocN32Pixels(100, 100);
- SkCanvas offscreen(bitmap);
- offscreen.clear(0);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(SK_ColorBLUE);
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(20);
- offscreen.drawCircle(50, 50, 39, paint);
- offscreen.flush();
- bitmap.extractAlpha(&alpha);
- paint.setColor(SK_ColorRED);
- canvas->drawBitmap(bitmap, 0, 0, &paint);
+ SkBitmap alpha, bitmap; + bitmap.allocN32Pixels(100, 100); + SkCanvas offscreen(bitmap); + offscreen.clear(0); + SkPaint paint; + paint.setAntiAlias(true); + paint.setColor(SK_ColorBLUE); + paint.setStyle(SkPaint::kStroke_Style); + paint.setStrokeWidth(20); + offscreen.drawCircle(50, 50, 39, paint); + offscreen.flush(); + bitmap.extractAlpha(&alpha); + paint.setColor(SK_ColorRED); + canvas->drawBitmap(bitmap, 0, 0, &paint); canvas->drawBitmap(alpha, 100, 0, &paint); ## @@ -3464,25 +3464,25 @@ Pixel_Ref. Sets offset to top-left position for dst for alignment with Bitmap; #Bug 7103 ## #Example #Height 160 - SkBitmap alpha, bitmap;
- bitmap.allocN32Pixels(100, 100);
- SkCanvas offscreen(bitmap);
- offscreen.clear(0);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(SK_ColorBLUE);
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(20);
- offscreen.drawCircle(50, 50, 39, paint);
- offscreen.flush();
- const SkScalar kBlurSigma = SkBlurMaskFilter::ConvertRadiusToSigma(SkIntToScalar(25));
- paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kBlurSigma,
- SkBlurMaskFilter::kHighQuality_BlurFlag));
- SkIPoint offset;
- bitmap.extractAlpha(&alpha, &paint, &offset);
- paint.setColor(SK_ColorRED);
- canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
- canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
+ SkBitmap alpha, bitmap; + bitmap.allocN32Pixels(100, 100); + SkCanvas offscreen(bitmap); + offscreen.clear(0); + SkPaint paint; + paint.setAntiAlias(true); + paint.setColor(SK_ColorBLUE); + paint.setStyle(SkPaint::kStroke_Style); + paint.setStrokeWidth(20); + offscreen.drawCircle(50, 50, 39, paint); + offscreen.flush(); + const SkScalar kBlurSigma = SkBlurMaskFilter::ConvertRadiusToSigma(SkIntToScalar(25)); + paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kBlurSigma, + SkBlurMaskFilter::kHighQuality_BlurFlag)); + SkIPoint offset; + bitmap.extractAlpha(&alpha, &paint, &offset); + paint.setColor(SK_ColorRED); + canvas->drawBitmap(bitmap, 0, -offset.fY, &paint); + canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint); ## #SeeAlso extractSubset @@ -3513,23 +3513,23 @@ mask. #Bug 7104 ## #Example #Height 128 - SkBitmap alpha, bitmap;
- bitmap.allocN32Pixels(100, 100);
- SkCanvas offscreen(bitmap);
- offscreen.clear(0);
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(SK_ColorBLUE);
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(20);
- offscreen.drawCircle(50, 50, 39, paint);
- offscreen.flush();
+ SkBitmap alpha, bitmap; + bitmap.allocN32Pixels(100, 100); + SkCanvas offscreen(bitmap); + offscreen.clear(0); + SkPaint paint; + paint.setAntiAlias(true); + paint.setColor(SK_ColorBLUE); + paint.setStyle(SkPaint::kStroke_Style); + paint.setStrokeWidth(20); + offscreen.drawCircle(50, 50, 39, paint); + offscreen.flush(); paint.setMaskFilter(SkBlurMaskFilter::Make(kOuter_SkBlurStyle, 3)); - SkIPoint offset;
- bitmap.extractAlpha(&alpha, &paint, nullptr, &offset);
- paint.setColor(SK_ColorRED);
- canvas->drawBitmap(bitmap, 0, -offset.fY, &paint);
- canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint);
+ SkIPoint offset; + bitmap.extractAlpha(&alpha, &paint, nullptr, &offset); + paint.setColor(SK_ColorRED); + canvas->drawBitmap(bitmap, 0, -offset.fY, &paint); + canvas->drawBitmap(alpha, 100 + offset.fX, 0, &paint); ## #SeeAlso extractSubset @@ -3551,34 +3551,34 @@ is changed in any way, in which case the results are invalid. #Return true if Bitmap has direct access to pixels ## #Example - SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(6, 11));
- SkCanvas offscreen(bitmap);
- offscreen.clear(SK_ColorWHITE);
- SkPaint paint;
- offscreen.drawString("?", 0, 10, paint);
- SkPixmap pixmap;
- if (bitmap.peekPixels(&pixmap)) {
- const SkPMColor* pixels = pixmap.addr32();
- SkPMColor pmWhite = pixels[0];
- for (int y = 0; y < bitmap.height(); ++y) {
- for (int x = 0; x < bitmap.width(); ++x) {
- SkDebugf("%c", *pixels++ == pmWhite ? '-' : 'x');
- }
- SkDebugf("\n");
- }
- }
+ SkBitmap bitmap; + bitmap.allocPixels(SkImageInfo::MakeN32Premul(6, 11)); + SkCanvas offscreen(bitmap); + offscreen.clear(SK_ColorWHITE); + SkPaint paint; + offscreen.drawString("?", 0, 10, paint); + SkPixmap pixmap; + if (bitmap.peekPixels(&pixmap)) { + const SkPMColor* pixels = pixmap.addr32(); + SkPMColor pmWhite = pixels[0]; + for (int y = 0; y < bitmap.height(); ++y) { + for (int x = 0; x < bitmap.width(); ++x) { + SkDebugf("%c", *pixels++ == pmWhite ? '-' : 'x'); + } + SkDebugf("\n"); + } + } #StdOut - ------
- --xxx-
- -x--x-
- ----x-
- ---xx-
- --xx--
- --x---
- ------
- --x---
- --x---
+ ------ + --xxx- + -x--x- + ----x- + ---xx- + --xx-- + --x--- + ------ + --x--- + --x--- ------ #StdOut ## ## @@ -3604,18 +3604,18 @@ suppressed by defining SK_IGNORE_TO_STRING. #Param str storage for string representation ## #Example - SkBitmap bitmap;
- int width = 6;
- int height = 11;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
- SkString string;
- bitmap.toString(&string);
- SkString match;
- match.printf("(%d, %d)", width, height);
- int start = string.find(match.c_str());
- if (start >= 0) {
- SkString whStr(&string.c_str()[start], match.size());
- SkDebugf("bitmap dimensions %s\n", whStr.c_str());
+ SkBitmap bitmap; + int width = 6; + int height = 11; + bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); + SkString string; + bitmap.toString(&string); + SkString match; + match.printf("(%d, %d)", width, height); + int start = string.find(match.c_str()); + if (start >= 0) { + SkString whStr(&string.c_str()[start], match.size()); + SkDebugf("bitmap dimensions %s\n", whStr.c_str()); } #StdOut bitmap dimensions (6, 11) diff --git a/docs/SkPixmap_Reference.bmh b/docs/SkPixmap_Reference.bmh index 09fb1a68fe..837d3af153 100644 --- a/docs/SkPixmap_Reference.bmh +++ b/docs/SkPixmap_Reference.bmh @@ -799,14 +799,14 @@ Returns height() times rowBytes if colorType is kUnknown_SkColorType. } } #StdOut -width: 1 height: 1 computeByteSize: 4
-width: 1 height: 1000 computeByteSize: 4999
-width: 1 height: 1000000 computeByteSize: 4999999
-width: 1000 height: 1 computeByteSize: 4000
-width: 1000 height: 1000 computeByteSize: 4999000
-width: 1000 height: 1000000 computeByteSize: 4999999000
-width: 1000000 height: 1 computeByteSize: 4000000
-width: 1000000 height: 1000 computeByteSize: 4999000000
+width: 1 height: 1 computeByteSize: 4 +width: 1 height: 1000 computeByteSize: 4999 +width: 1 height: 1000000 computeByteSize: 4999999 +width: 1000 height: 1 computeByteSize: 4000 +width: 1000 height: 1000 computeByteSize: 4999000 +width: 1000 height: 1000000 computeByteSize: 4999999000 +width: 1000000 height: 1 computeByteSize: 4000000 +width: 1000000 height: 1000 computeByteSize: 4999000000 width: 1000000 height: 1000000 computeByteSize: 4999999000000 ## ## diff --git a/docs/usingBookmaker.bmh b/docs/usingBookmaker.bmh index 4e1f84b864..f0f79d213e 100644 --- a/docs/usingBookmaker.bmh +++ b/docs/usingBookmaker.bmh @@ -1,143 +1,143 @@ -#External
-SkXXX
-bmh_SkXXX
-CL
-Go
-Visual_Studio
-##
-
-#Topic Bookmaker
-
-How to use the Bookmaker utility.
-
-Install
-#A Go # https://golang.org/doc/install ##
- if needed.
-Get the fiddle command line interface tool.
-By default this will appear in your home directory.
-
-#Code
-$ go get go.skia.org/infra/fiddle/go/fiddlecli
-##
-
-Build Bookmaker.
-
-#Code
-$ ninja -C out/dir bookmaker
-##
-
-Generate an starter Bookmaker file from an existing include.
-
-#Code
-$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs
-##
-
-If a method or function has an unnamed parameter, bookmaker generates an error:
-
-#Code
-###$
-C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name
-bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const
- ^
-$$$#
-##
-
-All parameters require names to allow markdown and doxygen documents to refer to
-them. After naming all parameters, check in the include before continuing.
-
-A successful run generates
-#Code
-docs/SkXXX_Reference.bmh
-##
-.
-
-Next, use your favorite editor to fill out
-#Code
-docs/SkXXX_Reference.bmh
-##
-.
-
-#Subtopic Style
-
-Documentation consists of cross references, descriptions, and examples.
-All structs, classes, enums, their members and methods, functions, and so on,
-require descriptions. Most also require examples.
-
-All methods and functions should include examples if practical.
-
-Descriptions start with an active verb. Descriptions are complete, punctuated
-sentences unless they describe parameters or return values. Parameters and
-returned values are described by phrases that start lower case and do not
-include trailing punctuation.
-
-Descriptions are not self-referential; they do not include the thing they
-describe. Descriptions may contain upper case references to definitions
-but otherwise should be free of jargon.
-
-Descriptions may contain code and formulas, each bracketed by markup.
-
-Similar items may be grouped into topics. Topics may include subtopics.
-
-Each document begins with one or more indices that include the contents of
-that file. A class reference includes an index listing contained topics,
-a separate listing for constructors, one for methods, and so on.
-
-Class methods contain a description, any parameters, any return value,
-an example, and any cross references.
-
-Each method must contain either one or more examples or markup indicating
-that there is no example.
-
-##
-
-Generate fiddle.json from all examples, including the ones you just wrote.
-Error checking is syntatic: starting keywords are closed, keywords have the
-correct parents.
-If you run Bookmaker inside Visual_Studio, you can click on errors and it
-will take you to the source line in question.
-
-#Code
-$ ./out/dir/bookmaker -e fiddle.json -b docs
-##
-
-Once complete, run fiddlecli to generate the example hashes.
-Errors are contained by the output but aren't reported yet.
-
-#Code
-$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json
-##
-
-Generate bmh_SkXXX.md from SkXXX.bmh and fiddleout.json.
-Error checking includes: undefined references, fiddle compiler errors,
-missing or mismatched printf output.
-Again, you can click on any errors inside Visual_Studio.
-
-#Code
-$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
-##
-
-The original include may have changed since you started creating the markdown.
-Check to see if it is up to date.
-This reports if a method no longer exists or its parameters have changed.
-
-#Code
-$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
-##
-
-Generate an updated include header. Run:
-
-#Code
-$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
-##
-
-to write the updated SkXXX.h to the current directory.
-
-#Subtopic Bugs
-
-Bookmaker bugs are tracked
-#A here # bug.skia.org/6898 ##
-.
-
-##
-
-#Topic Bookmaker ##
+#External +SkXXX +bmh_SkXXX +CL +Go +Visual_Studio +## + +#Topic Bookmaker + +How to use the Bookmaker utility. + +Install +#A Go # https://golang.org/doc/install ## + if needed. +Get the fiddle command line interface tool. +By default this will appear in your home directory. + +#Code +$ go get go.skia.org/infra/fiddle/go/fiddlecli +## + +Build Bookmaker. + +#Code +$ ninja -C out/dir bookmaker +## + +Generate an starter Bookmaker file from an existing include. + +#Code +$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs +## + +If a method or function has an unnamed parameter, bookmaker generates an error: + +#Code +###$ +C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name +bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const + ^ +$$$# +## + +All parameters require names to allow markdown and doxygen documents to refer to +them. After naming all parameters, check in the include before continuing. + +A successful run generates +#Code +docs/SkXXX_Reference.bmh +## +. + +Next, use your favorite editor to fill out +#Code +docs/SkXXX_Reference.bmh +## +. + +#Subtopic Style + +Documentation consists of cross references, descriptions, and examples. +All structs, classes, enums, their members and methods, functions, and so on, +require descriptions. Most also require examples. + +All methods and functions should include examples if practical. + +Descriptions start with an active verb. Descriptions are complete, punctuated +sentences unless they describe parameters or return values. Parameters and +returned values are described by phrases that start lower case and do not +include trailing punctuation. + +Descriptions are not self-referential; they do not include the thing they +describe. Descriptions may contain upper case references to definitions +but otherwise should be free of jargon. + +Descriptions may contain code and formulas, each bracketed by markup. + +Similar items may be grouped into topics. Topics may include subtopics. + +Each document begins with one or more indices that include the contents of +that file. A class reference includes an index listing contained topics, +a separate listing for constructors, one for methods, and so on. + +Class methods contain a description, any parameters, any return value, +an example, and any cross references. + +Each method must contain either one or more examples or markup indicating +that there is no example. + +## + +Generate fiddle.json from all examples, including the ones you just wrote. +Error checking is syntatic: starting keywords are closed, keywords have the +correct parents. +If you run Bookmaker inside Visual_Studio, you can click on errors and it +will take you to the source line in question. + +#Code +$ ./out/dir/bookmaker -e fiddle.json -b docs +## + +Once complete, run fiddlecli to generate the example hashes. +Errors are contained by the output but aren't reported yet. + +#Code +$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json +## + +Generate bmh_SkXXX.md from SkXXX.bmh and fiddleout.json. +Error checking includes: undefined references, fiddle compiler errors, +missing or mismatched printf output. +Again, you can click on any errors inside Visual_Studio. + +#Code +$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json +## + +The original include may have changed since you started creating the markdown. +Check to see if it is up to date. +This reports if a method no longer exists or its parameters have changed. + +#Code +$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h +## + +Generate an updated include header. Run: + +#Code +$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h +## + +to write the updated SkXXX.h to the current directory. + +#Subtopic Bugs + +Bookmaker bugs are tracked +#A here # bug.skia.org/6898 ## +. + +## + +#Topic Bookmaker ## diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp index 6bbcd9012b..5c56167e07 100644 --- a/gm/cubicpaths.cpp +++ b/gm/cubicpaths.cpp @@ -422,27 +422,27 @@ DEF_SIMPLE_GM(bug5099, canvas, 50, 50) { } DEF_SIMPLE_GM(bug6083, canvas, 100, 50) { - SkPaint p;
- p.setColor(SK_ColorRED);
- p.setAntiAlias(true);
- p.setStyle(SkPaint::kStroke_Style);
- p.setStrokeWidth(15);
- canvas->translate(-500, -130);
- SkPath path;
- path.moveTo(500.988f, 155.200f);
- path.lineTo(526.109f, 155.200f);
- SkPoint p1 = { 526.109f, 155.200f };
- SkPoint p2 = { 525.968f, 212.968f };
- SkPoint p3 = { 526.109f, 241.840f };
- path.cubicTo(p1, p2, p3);
- canvas->drawPath(path, p);
- canvas->translate(50, 0);
- path.reset();
- p2.set(525.968f, 213.172f);
- path.moveTo(500.988f, 155.200f);
- path.lineTo(526.109f, 155.200f);
- path.cubicTo(p1, p2, p3);
- canvas->drawPath(path, p);
+ SkPaint p; + p.setColor(SK_ColorRED); + p.setAntiAlias(true); + p.setStyle(SkPaint::kStroke_Style); + p.setStrokeWidth(15); + canvas->translate(-500, -130); + SkPath path; + path.moveTo(500.988f, 155.200f); + path.lineTo(526.109f, 155.200f); + SkPoint p1 = { 526.109f, 155.200f }; + SkPoint p2 = { 525.968f, 212.968f }; + SkPoint p3 = { 526.109f, 241.840f }; + path.cubicTo(p1, p2, p3); + canvas->drawPath(path, p); + canvas->translate(50, 0); + path.reset(); + p2.set(525.968f, 213.172f); + path.moveTo(500.988f, 155.200f); + path.lineTo(526.109f, 155.200f); + path.cubicTo(p1, p2, p3); + canvas->drawPath(path, p); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp index 755ce5cf15..f0a8da3136 100644 --- a/src/pathops/SkPathOpsDebug.cpp +++ b/src/pathops/SkPathOpsDebug.cpp @@ -63,9 +63,9 @@ bool SkPathOpsDebug::ChaseContains(const SkTDArray<SkOpSpanBase* >& chaseArray, return false; } #endif -
-#if DEBUG_ACTIVE_SPANS
-SkString SkPathOpsDebug::gActiveSpans;
+ +#if DEBUG_ACTIVE_SPANS +SkString SkPathOpsDebug::gActiveSpans; #endif #if DEBUG_COIN @@ -333,15 +333,15 @@ void SkPathOpsDebug::ShowActiveSpans(SkOpContourHead* contourList) { do { contour->debugShowActiveSpans(&str); } while ((contour = contour->next())); - if (!gActiveSpans.equals(str)) {
- const char* s = str.c_str();
- const char* end;
- while ((end = strchr(s, '\n'))) {
- SkDebugf("%.*s", end - s + 1, s);
- s = end + 1;
- }
- gActiveSpans.set(str);
- }
+ if (!gActiveSpans.equals(str)) { + const char* s = str.c_str(); + const char* end; + while ((end = strchr(s, '\n'))) { + SkDebugf("%.*s", end - s + 1, s); + s = end + 1; + } + gActiveSpans.set(str); + } #endif } diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h index 97fa534a2a..65aedc55df 100644 --- a/src/pathops/SkPathOpsDebug.h +++ b/src/pathops/SkPathOpsDebug.h @@ -394,8 +394,8 @@ public: static void VerifySimplify(const SkPath& path, const SkPath& result); #endif -#if DEBUG_ACTIVE_SPANS
- static SkString gActiveSpans;
+#if DEBUG_ACTIVE_SPANS + static SkString gActiveSpans; #endif }; diff --git a/tools/bookmaker/mdOut.cpp b/tools/bookmaker/mdOut.cpp index 0b0b2e1bca..14e34a0131 100644 --- a/tools/bookmaker/mdOut.cpp +++ b/tools/bookmaker/mdOut.cpp @@ -301,8 +301,8 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) { SkDebugf("could not open output file %s\n", fullName.c_str()); return false; } - size_t underscorePos = header.find('_');
- if (string::npos != underscorePos) {
+ size_t underscorePos = header.find('_'); + if (string::npos != underscorePos) { header.replace(underscorePos, 1, " "); } SkASSERT(string::npos == header.find('_')); diff --git a/tools/mdbviz/resources.qrc b/tools/mdbviz/resources.qrc index 0d8713fce2..e3e2dc0007 100644 --- a/tools/mdbviz/resources.qrc +++ b/tools/mdbviz/resources.qrc @@ -1,5 +1,5 @@ -<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>images/open.png</file>
-</qresource>
+<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>images/open.png</file> +</qresource> </RCC>
\ No newline at end of file diff --git a/tools/pathops_sorter.htm b/tools/pathops_sorter.htm index d8371ad9be..42708c428c 100644 --- a/tools/pathops_sorter.htm +++ b/tools/pathops_sorter.htm @@ -1,4 +1,4 @@ -<!DOCTYPE html> +<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> @@ -7,14 +7,14 @@ <div style="height:0"> <div id="cubics"> -{{{152, 16}, {152, 16.0685501}, {91.06044, 16.1242027}, {16, 16.1242027}}}, id=0
-{{{16, 16.1242027}, {-59.06044, 16.1242027}, {-120, 16.0685501}, {-120, 16}}}, id=1
-{{{-120, 16}, {-120, 15.9314508}, {-59.06044, 15.8757973}, {16, 15.8757973}}}, id=2
-{{{16, 15.8757973}, {91.06044, 15.8757973}, {152, 15.9314508}, {152, 16}}}, id=3
-{{{16, 16}, {152, 16}}}, id=4
-{{{16, 17}, {152, 17}}}, id=5
-{{{16, 16}, {16, 17}}}, id=6
-{{{152, 16}, {152, 17}}}, id=7
+{{{152, 16}, {152, 16.0685501}, {91.06044, 16.1242027}, {16, 16.1242027}}}, id=0 +{{{16, 16.1242027}, {-59.06044, 16.1242027}, {-120, 16.0685501}, {-120, 16}}}, id=1 +{{{-120, 16}, {-120, 15.9314508}, {-59.06044, 15.8757973}, {16, 15.8757973}}}, id=2 +{{{16, 15.8757973}, {91.06044, 15.8757973}, {152, 15.9314508}, {152, 16}}}, id=3 +{{{16, 16}, {152, 16}}}, id=4 +{{{16, 17}, {152, 17}}}, id=5 +{{{16, 16}, {16, 17}}}, id=6 +{{{152, 16}, {152, 17}}}, id=7 </div> </div> @@ -145,7 +145,7 @@ mouseX = (screenWidth / 2) / hscale + srcLeft; mouseY = (screenHeight / 2) / vscale + srcTop; hinitScale = hscale; - vinitScale = vscale;
+ vinitScale = vscale; } function setScale(x0, x1, y0, y1) { @@ -160,7 +160,7 @@ vscale = screenHeight / srcHeight; if (uniformScale) { hscale = Math.min(hscale, vscale); - vscale = hscale;
+ vscale = hscale; } var hinvScale = 1 / hscale; var vinvScale = 1 / vscale; @@ -897,10 +897,10 @@ function dxy_at_t(curve, t) { var scaleTextOffset = hscale != vscale ? -25 : -5; ctx.fillText(hscale.toFixed(decimal_places) + 'x', screenWidth - 10, screenHeight - scaleTextOffset); - if (hscale != vscale) {
+ if (hscale != vscale) { ctx.fillText(vscale.toFixed(decimal_places) + 'y', - screenWidth - 10, screenHeight - 5);
- }
+ screenWidth - 10, screenHeight - 5); + } } if (draw_t) { drawPointAtT(curve); @@ -1105,10 +1105,10 @@ function dxy_at_t(curve, t) { if (focusWasOn) { focus_on_selection = false; hscale /= 1.2; - vscale /= 1.2;
+ vscale /= 1.2; } else { - hscale /= 2;
- vscale /= 2;
+ hscale /= 2; + vscale /= 2; } calcLeftTop(); redraw(); @@ -1119,11 +1119,11 @@ function dxy_at_t(curve, t) { focusWasOn = focus_on_selection; if (focusWasOn) { focus_on_selection = false; - hscale *= 1.2;
- vscale *= 1.2;
+ hscale *= 1.2; + vscale *= 1.2; } else { - hscale *= 2;
- vscale *= 2;
+ hscale *= 2; + vscale *= 2; } calcLeftTop(); redraw(); diff --git a/tools/pathops_visualizer.htm b/tools/pathops_visualizer.htm index 99acb76a6f..fafd2811ca 100644 --- a/tools/pathops_visualizer.htm +++ b/tools/pathops_visualizer.htm @@ -1,217 +1,217 @@ <html> <head> <div height="0" hidden="true"> -
-Skia UnitTests: --match PathOpsOp$ --resourcePath resources\ SK_DEBUG
-<div id="android1">
-seg=1 {{{-5, 0}, {1075, 0}}}
-seg=2 {{{1075, 0}, {1075, 242}}}
-seg=3 {{{1075, 242}, {-5, 242}}}
-seg=4 {{{-5, 242}, {-5, 0}}}
-op sect
-seg=5 {{{0, 0}, {1080, 0}}}
-seg=6 {{{1080, 0}, {1080, 242}}}
-seg=7 {{{1080, 242}, {0, 242}}}
-seg=8 {{{0, 242}, {0, 0}}}
-debugShowLineIntersection wtTs[0]=0 {{{1075,0}, {1075,242}}} {{1075,0}} wnTs[0]=1 {{{-5,0}, {1075,0}}}
-debugShowLineIntersection wtTs[0]=1 {{{-5,242}, {-5,0}}} {{-5,0}} wnTs[0]=0 {{{-5,0}, {1075,0}}}
-debugShowLineIntersection wtTs[0]=0 {{{1075,242}, {-5,242}}} {{1075,242}} wnTs[0]=1 {{{1075,0}, {1075,242}}}
-debugShowLineIntersection wtTs[0]=0 {{{-5,242}, {-5,0}}} {{-5,242}} wnTs[0]=1 {{{1075,242}, {-5,242}}}
-debugShowLineIntersection wtTs[0]=0 {{{0,0}, {1080,0}}} {{0,0}} wtTs[1]=0.99537037 {{1075,0}} wnTs[0]=0.00462963 {{{-5,0}, {1075,0}}} wnTs[1]=1
-SkOpSegment::addT insert t=0.00462962963 segID=1 spanID=17
-SkOpSegment::addT insert t=0.99537037 segID=5 spanID=18
-debugShowLineIntersection wtTs[0]=1 {{{0,242}, {0,0}}} {{0,0}} wnTs[0]=0.00462963 {{{-5,0}, {1075,0}}}
-debugShowLineIntersection wtTs[0]=0.99537037 {{{0,0}, {1080,0}}} {{1075,0}} wnTs[0]=0 {{{1075,0}, {1075,242}}}
-debugShowLineIntersection wtTs[0]=0.00462962963 {{{1080,242}, {0,242}}} {{1075,242}} wnTs[0]=1 {{{1075,0}, {1075,242}}}
-SkOpSegment::addT insert t=0.00462962963 segID=7 spanID=19
-debugShowLineIntersection wtTs[0]=0.00462962963 {{{1080,242}, {0,242}}} {{1075,242}} wtTs[1]=1 {{0,242}} wnTs[0]=0 {{{1075,242}, {-5,242}}} wnTs[1]=0.99537037
-SkOpSegment::addT insert t=0.99537037 segID=3 spanID=20
-debugShowLineIntersection wtTs[0]=0 {{{0,242}, {0,0}}} {{0,242}} wnTs[0]=0.99537 {{{1075,242}, {-5,242}}}
-debugShowLineIntersection wtTs[0]=0 {{{1080,0}, {1080,242}}} {{1080,0}} wnTs[0]=1 {{{0,0}, {1080,0}}}
-debugShowLineIntersection wtTs[0]=1 {{{0,242}, {0,0}}} {{0,0}} wnTs[0]=0 {{{0,0}, {1080,0}}}
-debugShowLineIntersection wtTs[0]=0 {{{1080,242}, {0,242}}} {{1080,242}} wnTs[0]=1 {{{1080,0}, {1080,242}}}
-debugShowLineIntersection wtTs[0]=0 {{{0,242}, {0,0}}} {{0,242}} wnTs[0]=1 {{{1080,242}, {0,242}}}
-------------------x--x---------------- addExpanded
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-SkOpSegment::debugShowActiveSpans id=1 (-5,0 -8.8817842e-16,0) t=0 tEnd=0.00462962963 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=3 (2.22044605e-14,242 -5,242) t=0.99537037 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=4 (-5,242 -5,0) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=5 (0,0 1075,0) t=0 tEnd=0.99537037 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=7 (1075,242 0,242) t=0.00462962963 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=? windValue=1
-------------------x--x---------------- move_multiples
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- move_nearby
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- correctEnds
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- addEndMovedSpans
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- expand
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- addExpanded
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
-------------------x--x---------------- mark
-00: seg/base=3/5 seg/base=7/19 MarkCoinStart
-01: seg/base=3/20 seg/base=7/14 MarkCoinEnd
-02: seg/base=1/17 seg/base=5/9 MarkCoinStart
-03: seg/base=1/2 seg/base=5/18 MarkCoinEnd
--------------------------------------- missing_coincidence
--------------------------------------- expand
--------------------------------------- expand
--------------------------------------- apply
-SkOpSegment::markDone id=7 (1080,242 0,242) t=0.00462962963 [19] (1075,242) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
-SkOpSegment::markDone id=5 (0,0 1080,0) t=0 [9] (0,0) tEnd=0.99537037 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
--------------------------------------- findOverlaps
-SkOpSegment::debugShowActiveSpans id=1 (-5,0 -8.8817842e-16,0) t=0 tEnd=0.00462962963 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
-SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=? oppSum=? windValue=1 oppValue=1
-SkOpSegment::debugShowActiveSpans id=3 (2.22044605e-14,242 -5,242) t=0.99537037 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=4 (-5,242 -5,0) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=? windValue=1
--------------------------------------- calc_angles
-SkOpSegment::sortAngles [1] tStart=0.00462962963 [17]
-SkOpAngle::after [1/1] 15/15 tStart=0.00462962963 tEnd=0 < [8/12] 23/23 tStart=1 tEnd=0 < [1/2] 31/31 tStart=0.00462962963 tEnd=1 T 4
-SkOpAngle::afterPart {{{0,0}, {-5,0}}} id=1
-SkOpAngle::afterPart {{{0,0}, {0,242}}} id=8
-SkOpAngle::afterPart {{{0,0}, {1075,0}}} id=1
-SkOpSegment::sortAngles [1] tStart=1 [2]
-SkOpAngle::after [1/3] 15/15 tStart=1 tEnd=0.00462962963 < [2/4] 23/23 tStart=0 tEnd=1 < [5/9] 31/31 tStart=0.99537037 tEnd=1 T 4
-SkOpAngle::afterPart {{{1075,0}, {-8.8817842e-16,0}}} id=1
-SkOpAngle::afterPart {{{1075,0}, {1075,242}}} id=2
-SkOpAngle::afterPart {{{1075,0}, {1080,0}}} id=5
-SkOpSegment::sortAngles [2] tStart=0 [3]
-SkOpSegment::sortAngles [2] tStart=1 [4]
-SkOpAngle::after [2/5] 7/7 tStart=1 tEnd=0 < [3/6] 15/15 tStart=0 tEnd=0.99537037 < [7/10] 31/31 tStart=0.00462962963 tEnd=0 T 4
-SkOpAngle::afterPart {{{1075,242}, {1075,0}}} id=2
-SkOpAngle::afterPart {{{1075,242}, {2.22044605e-14,242}}} id=3
-SkOpAngle::afterPart {{{1075,242}, {1080,242}}} id=7
-SkOpSegment::sortAngles [3] tStart=0 [5]
-SkOpSegment::sortAngles [3] tStart=0.99537037 [20]
-SkOpAngle::after [3/7] 31/31 tStart=0.99537037 tEnd=0 < [8/11] 7/7 tStart=0 tEnd=1 < [3/8] 15/15 tStart=0.99537037 tEnd=1 T 4
-SkOpAngle::afterPart {{{0,242}, {1075,242}}} id=3
-SkOpAngle::afterPart {{{0,242}, {0,0}}} id=8
-SkOpAngle::afterPart {{{0,242}, {-5,242}}} id=3
-SkOpSegment::sortAngles [5] tStart=0.99537037 [18]
-SkOpSegment::sortAngles [7] tStart=0.00462962963 [19]
-SkOpSegment::sortAngles [8] tStart=0 [15]
-SkOpSegment::sortAngles [8] tStart=1 [16]
-coinSpan - id=3 t=0 tEnd=0.99537037
-coinSpan + id=7 t=0.00462962963 tEnd=1
-coinSpan - id=1 t=0.00462962963 tEnd=1
-coinSpan + id=5 t=0 tEnd=0.99537037
-SkOpSpan::sortableTop dir=kTop seg=1 t=0.00231481481 pt=(-2.5,0)
-SkOpSpan::sortableTop [0] valid=1 operand=0 span=1 ccw=1 seg=1 {{{-5, 0}, {1075, 0}}} t=0.00231481481 pt=(-2.5,0) slope=(1080,0)
-SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markWinding id=4 (-5,242 -5,0) t=0 [7] (-5,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markWinding id=3 (1075,242 -5,242) t=0.99537037 [20] (2.22044605e-14,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::activeOp id=1 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=0 result=0
-SkOpSegment::markDone id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markDone id=4 (-5,242 -5,0) t=0 [7] (-5,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markDone id=3 (1075,242 -5,242) t=0.99537037 [20] (2.22044605e-14,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-bridgeOp chase.append id=3 windSum=-1
-SkOpSegment::markWinding id=3 (1075,242 -5,242) t=0 [5] (1075,242) tEnd=0.99537037 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1
-SkOpSegment::markAngle last segment=3 span=5 windSum=-1
-SkOpSegment::markWinding id=8 (0,242 0,0) t=0 [15] (0,242) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markAngle last segment=8 span=16
-SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
-SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=-1 oppSum=-1 windValue=1 oppValue=1
-SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1
-SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=-1 oppSum=-1 windValue=1 oppValue=0
-SkOpSegment::activeOp id=3 t=0.99537037 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1
-SkOpSegment::markWinding id=7 (1080,242 0,242) t=0 [13] (1080,242) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markWinding id=6 (1080,0 1080,242) t=0 [11] (1080,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markWinding id=5 (0,0 1080,0) t=0.99537037 [18] (1075,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markAngle last segment=5 span=18 windSum=-1
-SkOpSegment::markWinding id=2 (1075,0 1075,242) t=0 [3] (1075,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
-SkOpSegment::markAngle last segment=2 span=3 windSum=-1
-SkOpSegment::findNextOp
-SkOpAngle::dumpOne [3/6] next=7/10 sect=15/15 s=0 [5] e=0.99537037 [20] sgn=-1 windVal=1 windSum=-1 oppVal=1 oppSum=-1
-SkOpAngle::dumpOne [7/10] next=2/5 sect=31/31 s=0.00462962963 [19] e=0 [13] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 operand
-SkOpAngle::dumpOne [2/5] next=3/6 sect=7/7 s=1 [4] e=0 [3] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1
-SkOpSegment::activeOp id=7 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
-SkOpSegment::markDone id=7 (1080,242 0,242) t=0 [13] (1080,242) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markDone id=6 (1080,0 1080,242) t=0 [11] (1080,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::markDone id=5 (0,0 1080,0) t=0.99537037 [18] (1075,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::findNextOp chase.append segment=5 span=18 windSum=-1
-SkOpSegment::activeOp id=2 t=1 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=1 suTo=1 result=1
-SkOpSegment::findNextOp chase.append segment=2 span=3 windSum=-1
-SkOpSegment::markDone id=3 (1075,242 -5,242) t=0 [5] (1075,242) tEnd=0.99537037 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=1
-SkOpSegment::findNextOp from:[3] to:[2] start=90366152 end=90366008
-bridgeOp current id=3 from=(2.22044605e-14,242) to=(1075,242)
-SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0.00462962963 [17] (-8.8817842e-16,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1
-SkOpSegment::markAngle last segment=1 span=17 windSum=-1
-SkOpSegment::findNextOp
-SkOpAngle::dumpOne [2/4] next=5/9 sect=23/23 s=0 [3] e=1 [4] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1
-SkOpAngle::dumpOne [5/9] next=1/3 sect=31/31 s=0.99537037 [18] e=1 [10] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done operand
-SkOpAngle::dumpOne [1/3] next=2/4 sect=15/15 s=1 [2] e=0.00462962963 [17] sgn=1 windVal=1 windSum=-1 oppVal=1 oppSum=-1
-SkOpSegment::activeOp id=5 t=0.99537037 tEnd=1 op=sect miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
-SkOpSegment::activeOp id=1 t=1 tEnd=0.00462962963 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1
-SkOpSegment::findNextOp chase.append segment=1 span=17 windSum=-1
-SkOpSegment::markDone id=2 (1075,0 1075,242) t=0 [3] (1075,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::findNextOp from:[2] to:[1] start=90365736 end=90368360
-bridgeOp current id=2 from=(1075,242) to=(1075,0)
-path.moveTo(2.22044605e-14,242);
-path.lineTo(1075,242);
-SkOpSegment::findNextOp
-SkOpAngle::dumpOne [1/2] next=1/1 sect=31/31 s=0.00462962963 [17] e=1 [2] sgn=-1 windVal=1 windSum=-1 oppVal=1 oppSum=-1
-SkOpAngle::dumpOne [1/1] next=8/12 sect=15/15 s=0.00462962963 [17] e=0 [1] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done
-SkOpAngle::dumpOne [8/12] next=1/2 sect=23/23 s=1 [16] e=0 [15] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand
-SkOpSegment::activeOp id=1 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=0 result=0
-SkOpSegment::activeOp id=8 t=1 tEnd=0 op=sect miFrom=1 miTo=1 suFrom=0 suTo=1 result=1
-SkOpSegment::markDone id=1 (-5,0 1075,0) t=0.00462962963 [17] (-8.8817842e-16,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=1
-SkOpSegment::findNextOp from:[1] to:[8] start=90368192 end=90368048
-bridgeOp current id=1 from=(1075,0) to=(-8.8817842e-16,0)
-path.lineTo(1075,0);
-SkOpSegment::findNextOp
-SkOpAngle::dumpOne [8/11] next=3/8 sect=7/7 s=0 [15] e=1 [16] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand
-SkOpAngle::dumpOne [3/8] next=3/7 sect=15/15 s=0.99537037 [20] e=1 [6] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done
-SkOpAngle::dumpOne [3/7] next=8/11 sect=31/31 s=0.99537037 [20] e=0 [5] sgn=1 windVal=1 windSum=-1 oppVal=1 oppSum=-1 done
-SkOpSegment::activeOp id=3 t=0.99537037 tEnd=1 op=sect miFrom=1 miTo=0 suFrom=0 suTo=0 result=0
-SkOpSegment::activeOp id=3 t=0.99537037 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1
-SkOpSegment::markDone id=8 (0,242 0,0) t=0 [15] (0,242) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
-SkOpSegment::findNextOp from:[8] to:[3] start=90368840 end=90366336
-bridgeOp current id=8 from=(0,0) to=(0,242)
-path.lineTo(-8.8817842e-16,0);
-path.lineTo(0,242);
-path.close();
-</div>
-
+ +Skia UnitTests: --match PathOpsOp$ --resourcePath resources\ SK_DEBUG +<div id="android1"> +seg=1 {{{-5, 0}, {1075, 0}}} +seg=2 {{{1075, 0}, {1075, 242}}} +seg=3 {{{1075, 242}, {-5, 242}}} +seg=4 {{{-5, 242}, {-5, 0}}} +op sect +seg=5 {{{0, 0}, {1080, 0}}} +seg=6 {{{1080, 0}, {1080, 242}}} +seg=7 {{{1080, 242}, {0, 242}}} +seg=8 {{{0, 242}, {0, 0}}} +debugShowLineIntersection wtTs[0]=0 {{{1075,0}, {1075,242}}} {{1075,0}} wnTs[0]=1 {{{-5,0}, {1075,0}}} +debugShowLineIntersection wtTs[0]=1 {{{-5,242}, {-5,0}}} {{-5,0}} wnTs[0]=0 {{{-5,0}, {1075,0}}} +debugShowLineIntersection wtTs[0]=0 {{{1075,242}, {-5,242}}} {{1075,242}} wnTs[0]=1 {{{1075,0}, {1075,242}}} +debugShowLineIntersection wtTs[0]=0 {{{-5,242}, {-5,0}}} {{-5,242}} wnTs[0]=1 {{{1075,242}, {-5,242}}} +debugShowLineIntersection wtTs[0]=0 {{{0,0}, {1080,0}}} {{0,0}} wtTs[1]=0.99537037 {{1075,0}} wnTs[0]=0.00462963 {{{-5,0}, {1075,0}}} wnTs[1]=1 +SkOpSegment::addT insert t=0.00462962963 segID=1 spanID=17 +SkOpSegment::addT insert t=0.99537037 segID=5 spanID=18 +debugShowLineIntersection wtTs[0]=1 {{{0,242}, {0,0}}} {{0,0}} wnTs[0]=0.00462963 {{{-5,0}, {1075,0}}} +debugShowLineIntersection wtTs[0]=0.99537037 {{{0,0}, {1080,0}}} {{1075,0}} wnTs[0]=0 {{{1075,0}, {1075,242}}} +debugShowLineIntersection wtTs[0]=0.00462962963 {{{1080,242}, {0,242}}} {{1075,242}} wnTs[0]=1 {{{1075,0}, {1075,242}}} +SkOpSegment::addT insert t=0.00462962963 segID=7 spanID=19 +debugShowLineIntersection wtTs[0]=0.00462962963 {{{1080,242}, {0,242}}} {{1075,242}} wtTs[1]=1 {{0,242}} wnTs[0]=0 {{{1075,242}, {-5,242}}} wnTs[1]=0.99537037 +SkOpSegment::addT insert t=0.99537037 segID=3 spanID=20 +debugShowLineIntersection wtTs[0]=0 {{{0,242}, {0,0}}} {{0,242}} wnTs[0]=0.99537 {{{1075,242}, {-5,242}}} +debugShowLineIntersection wtTs[0]=0 {{{1080,0}, {1080,242}}} {{1080,0}} wnTs[0]=1 {{{0,0}, {1080,0}}} +debugShowLineIntersection wtTs[0]=1 {{{0,242}, {0,0}}} {{0,0}} wnTs[0]=0 {{{0,0}, {1080,0}}} +debugShowLineIntersection wtTs[0]=0 {{{1080,242}, {0,242}}} {{1080,242}} wnTs[0]=1 {{{1080,0}, {1080,242}}} +debugShowLineIntersection wtTs[0]=0 {{{0,242}, {0,0}}} {{0,242}} wnTs[0]=1 {{{1080,242}, {0,242}}} +------------------x--x---------------- addExpanded +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +SkOpSegment::debugShowActiveSpans id=1 (-5,0 -8.8817842e-16,0) t=0 tEnd=0.00462962963 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=3 (2.22044605e-14,242 -5,242) t=0.99537037 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=4 (-5,242 -5,0) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=5 (0,0 1075,0) t=0 tEnd=0.99537037 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=7 (1075,242 0,242) t=0.00462962963 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=? windValue=1 +------------------x--x---------------- move_multiples +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- move_nearby +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- correctEnds +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- addEndMovedSpans +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- expand +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- addExpanded +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +------------------x--x---------------- mark +00: seg/base=3/5 seg/base=7/19 MarkCoinStart +01: seg/base=3/20 seg/base=7/14 MarkCoinEnd +02: seg/base=1/17 seg/base=5/9 MarkCoinStart +03: seg/base=1/2 seg/base=5/18 MarkCoinEnd +-------------------------------------- missing_coincidence +-------------------------------------- expand +-------------------------------------- expand +-------------------------------------- apply +SkOpSegment::markDone id=7 (1080,242 0,242) t=0.00462962963 [19] (1075,242) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0 +SkOpSegment::markDone id=5 (0,0 1080,0) t=0 [9] (0,0) tEnd=0.99537037 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0 +-------------------------------------- findOverlaps +SkOpSegment::debugShowActiveSpans id=1 (-5,0 -8.8817842e-16,0) t=0 tEnd=0.00462962963 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1 +SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=? oppSum=? windValue=1 oppValue=1 +SkOpSegment::debugShowActiveSpans id=3 (2.22044605e-14,242 -5,242) t=0.99537037 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=4 (-5,242 -5,0) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=? windValue=1 +-------------------------------------- calc_angles +SkOpSegment::sortAngles [1] tStart=0.00462962963 [17] +SkOpAngle::after [1/1] 15/15 tStart=0.00462962963 tEnd=0 < [8/12] 23/23 tStart=1 tEnd=0 < [1/2] 31/31 tStart=0.00462962963 tEnd=1 T 4 +SkOpAngle::afterPart {{{0,0}, {-5,0}}} id=1 +SkOpAngle::afterPart {{{0,0}, {0,242}}} id=8 +SkOpAngle::afterPart {{{0,0}, {1075,0}}} id=1 +SkOpSegment::sortAngles [1] tStart=1 [2] +SkOpAngle::after [1/3] 15/15 tStart=1 tEnd=0.00462962963 < [2/4] 23/23 tStart=0 tEnd=1 < [5/9] 31/31 tStart=0.99537037 tEnd=1 T 4 +SkOpAngle::afterPart {{{1075,0}, {-8.8817842e-16,0}}} id=1 +SkOpAngle::afterPart {{{1075,0}, {1075,242}}} id=2 +SkOpAngle::afterPart {{{1075,0}, {1080,0}}} id=5 +SkOpSegment::sortAngles [2] tStart=0 [3] +SkOpSegment::sortAngles [2] tStart=1 [4] +SkOpAngle::after [2/5] 7/7 tStart=1 tEnd=0 < [3/6] 15/15 tStart=0 tEnd=0.99537037 < [7/10] 31/31 tStart=0.00462962963 tEnd=0 T 4 +SkOpAngle::afterPart {{{1075,242}, {1075,0}}} id=2 +SkOpAngle::afterPart {{{1075,242}, {2.22044605e-14,242}}} id=3 +SkOpAngle::afterPart {{{1075,242}, {1080,242}}} id=7 +SkOpSegment::sortAngles [3] tStart=0 [5] +SkOpSegment::sortAngles [3] tStart=0.99537037 [20] +SkOpAngle::after [3/7] 31/31 tStart=0.99537037 tEnd=0 < [8/11] 7/7 tStart=0 tEnd=1 < [3/8] 15/15 tStart=0.99537037 tEnd=1 T 4 +SkOpAngle::afterPart {{{0,242}, {1075,242}}} id=3 +SkOpAngle::afterPart {{{0,242}, {0,0}}} id=8 +SkOpAngle::afterPart {{{0,242}, {-5,242}}} id=3 +SkOpSegment::sortAngles [5] tStart=0.99537037 [18] +SkOpSegment::sortAngles [7] tStart=0.00462962963 [19] +SkOpSegment::sortAngles [8] tStart=0 [15] +SkOpSegment::sortAngles [8] tStart=1 [16] +coinSpan - id=3 t=0 tEnd=0.99537037 +coinSpan + id=7 t=0.00462962963 tEnd=1 +coinSpan - id=1 t=0.00462962963 tEnd=1 +coinSpan + id=5 t=0 tEnd=0.99537037 +SkOpSpan::sortableTop dir=kTop seg=1 t=0.00231481481 pt=(-2.5,0) +SkOpSpan::sortableTop [0] valid=1 operand=0 span=1 ccw=1 seg=1 {{{-5, 0}, {1075, 0}}} t=0.00231481481 pt=(-2.5,0) slope=(1080,0) +SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markWinding id=4 (-5,242 -5,0) t=0 [7] (-5,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markWinding id=3 (1075,242 -5,242) t=0.99537037 [20] (2.22044605e-14,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::activeOp id=1 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=0 result=0 +SkOpSegment::markDone id=1 (-5,0 1075,0) t=0 [1] (-5,0) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markDone id=4 (-5,242 -5,0) t=0 [7] (-5,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markDone id=3 (1075,242 -5,242) t=0.99537037 [20] (2.22044605e-14,242) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +bridgeOp chase.append id=3 windSum=-1 +SkOpSegment::markWinding id=3 (1075,242 -5,242) t=0 [5] (1075,242) tEnd=0.99537037 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1 +SkOpSegment::markAngle last segment=3 span=5 windSum=-1 +SkOpSegment::markWinding id=8 (0,242 0,0) t=0 [15] (0,242) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markAngle last segment=8 span=16 +SkOpSegment::debugShowActiveSpans id=1 (-8.8817842e-16,0 1075,0) t=0.00462962963 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1 +SkOpSegment::debugShowActiveSpans id=2 (1075,0 1075,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=3 (1075,242 2.22044605e-14,242) t=0 tEnd=0.99537037 windSum=-1 oppSum=-1 windValue=1 oppValue=1 +SkOpSegment::debugShowActiveSpans id=5 (1075,0 1080,0) t=0.99537037 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=6 (1080,0 1080,242) t=0 tEnd=1 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=7 (1080,242 1075,242) t=0 tEnd=0.00462962963 windSum=? windValue=1 +SkOpSegment::debugShowActiveSpans id=8 (0,242 0,0) t=0 tEnd=1 windSum=-1 oppSum=-1 windValue=1 oppValue=0 +SkOpSegment::activeOp id=3 t=0.99537037 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1 +SkOpSegment::markWinding id=7 (1080,242 0,242) t=0 [13] (1080,242) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markWinding id=6 (1080,0 1080,242) t=0 [11] (1080,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markWinding id=5 (0,0 1080,0) t=0.99537037 [18] (1075,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markAngle last segment=5 span=18 windSum=-1 +SkOpSegment::markWinding id=2 (1075,0 1075,242) t=0 [3] (1075,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0 +SkOpSegment::markAngle last segment=2 span=3 windSum=-1 +SkOpSegment::findNextOp +SkOpAngle::dumpOne [3/6] next=7/10 sect=15/15 s=0 [5] e=0.99537037 [20] sgn=-1 windVal=1 windSum=-1 oppVal=1 oppSum=-1 +SkOpAngle::dumpOne [7/10] next=2/5 sect=31/31 s=0.00462962963 [19] e=0 [13] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 operand +SkOpAngle::dumpOne [2/5] next=3/6 sect=7/7 s=1 [4] e=0 [3] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 +SkOpSegment::activeOp id=7 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=0 suFrom=0 suTo=1 result=0 +SkOpSegment::markDone id=7 (1080,242 0,242) t=0 [13] (1080,242) tEnd=0.00462962963 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markDone id=6 (1080,0 1080,242) t=0 [11] (1080,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::markDone id=5 (0,0 1080,0) t=0.99537037 [18] (1075,0) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::findNextOp chase.append segment=5 span=18 windSum=-1 +SkOpSegment::activeOp id=2 t=1 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=1 suTo=1 result=1 +SkOpSegment::findNextOp chase.append segment=2 span=3 windSum=-1 +SkOpSegment::markDone id=3 (1075,242 -5,242) t=0 [5] (1075,242) tEnd=0.99537037 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=1 +SkOpSegment::findNextOp from:[3] to:[2] start=90366152 end=90366008 +bridgeOp current id=3 from=(2.22044605e-14,242) to=(1075,242) +SkOpSegment::markWinding id=1 (-5,0 1075,0) t=0.00462962963 [17] (-8.8817842e-16,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1 +SkOpSegment::markAngle last segment=1 span=17 windSum=-1 +SkOpSegment::findNextOp +SkOpAngle::dumpOne [2/4] next=5/9 sect=23/23 s=0 [3] e=1 [4] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 +SkOpAngle::dumpOne [5/9] next=1/3 sect=31/31 s=0.99537037 [18] e=1 [10] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done operand +SkOpAngle::dumpOne [1/3] next=2/4 sect=15/15 s=1 [2] e=0.00462962963 [17] sgn=1 windVal=1 windSum=-1 oppVal=1 oppSum=-1 +SkOpSegment::activeOp id=5 t=0.99537037 tEnd=1 op=sect miFrom=0 miTo=0 suFrom=1 suTo=0 result=0 +SkOpSegment::activeOp id=1 t=1 tEnd=0.00462962963 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1 +SkOpSegment::findNextOp chase.append segment=1 span=17 windSum=-1 +SkOpSegment::markDone id=2 (1075,0 1075,242) t=0 [3] (1075,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::findNextOp from:[2] to:[1] start=90365736 end=90368360 +bridgeOp current id=2 from=(1075,242) to=(1075,0) +path.moveTo(2.22044605e-14,242); +path.lineTo(1075,242); +SkOpSegment::findNextOp +SkOpAngle::dumpOne [1/2] next=1/1 sect=31/31 s=0.00462962963 [17] e=1 [2] sgn=-1 windVal=1 windSum=-1 oppVal=1 oppSum=-1 +SkOpAngle::dumpOne [1/1] next=8/12 sect=15/15 s=0.00462962963 [17] e=0 [1] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done +SkOpAngle::dumpOne [8/12] next=1/2 sect=23/23 s=1 [16] e=0 [15] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand +SkOpSegment::activeOp id=1 t=0.00462962963 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=0 result=0 +SkOpSegment::activeOp id=8 t=1 tEnd=0 op=sect miFrom=1 miTo=1 suFrom=0 suTo=1 result=1 +SkOpSegment::markDone id=1 (-5,0 1075,0) t=0.00462962963 [17] (-8.8817842e-16,0) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=1 +SkOpSegment::findNextOp from:[1] to:[8] start=90368192 end=90368048 +bridgeOp current id=1 from=(1075,0) to=(-8.8817842e-16,0) +path.lineTo(1075,0); +SkOpSegment::findNextOp +SkOpAngle::dumpOne [8/11] next=3/8 sect=7/7 s=0 [15] e=1 [16] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand +SkOpAngle::dumpOne [3/8] next=3/7 sect=15/15 s=0.99537037 [20] e=1 [6] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done +SkOpAngle::dumpOne [3/7] next=8/11 sect=31/31 s=0.99537037 [20] e=0 [5] sgn=1 windVal=1 windSum=-1 oppVal=1 oppSum=-1 done +SkOpSegment::activeOp id=3 t=0.99537037 tEnd=1 op=sect miFrom=1 miTo=0 suFrom=0 suTo=0 result=0 +SkOpSegment::activeOp id=3 t=0.99537037 tEnd=0 op=sect miFrom=0 miTo=1 suFrom=0 suTo=1 result=1 +SkOpSegment::markDone id=8 (0,242 0,0) t=0 [15] (0,242) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0 +SkOpSegment::findNextOp from:[8] to:[3] start=90368840 end=90366336 +bridgeOp current id=8 from=(0,0) to=(0,242) +path.lineTo(-8.8817842e-16,0); +path.lineTo(0,242); +path.close(); +</div> + </div> <script type="text/javascript"> @@ -2226,9 +2226,9 @@ function dxy_at_t(curve, type, t) { return dxy; } -function dpt_at_t(curve, t) {
+function dpt_at_t(curve, t) { var type = PATH_LINE + (curve.length / 2 - 2); - return dxy_at_t(curve, type, t);
+ return dxy_at_t(curve, type, t); } function drawLabel(num, px, py) { @@ -2346,11 +2346,11 @@ function y_at_t(curve, t) { return a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7]; } -function pt_at_t(curve, t) {
- var pt = {};
- pt.x = x_at_t(curve, t);
- pt.y = y_at_t(curve, t);
- return pt;
+function pt_at_t(curve, t) { + var pt = {}; + pt.x = x_at_t(curve, t); + pt.y = y_at_t(curve, t); + return pt; } function drawOrder(curve, t, label) { @@ -2377,59 +2377,59 @@ function drawOrder(curve, t, label) { ctx.font = "normal 10px Arial"; } -function drawVisibleOrder(curve, label) {
- var s = pt_at_t(curve, 0);
- var e = pt_at_t(curve, 1);
- var sOn = ptOnScreen(s);
- var eOn = ptOnScreen(e);
- var defaultT = 0.85;
- if (sOn && eOn)
- return drawOrder(curve, defaultT, label);
- if (sOn || eOn) {
- if (eOn) {
- defaultT = 1 - defaultT;
- }
- var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2;
- var t = defaultT;
- var tries = 16;
- do {
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawOrder(curve, t, label);
- t += step;
- step /= 2;
- } while (--tries > 0);
- drawOrder(curve, defaultT, label);
- }
- // scattershot until we find a visible point
- var denom = 2; // visit odd number num / denom to hit unique pts
- var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ...
- do {
- for (var numer = 1; numer < denom; numer += 2) {
- var t = numer / denom + 0.1;
- if (t >= 1) {
- break;
- }
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawOrder(curve, t, label);
- }
- denom *= 2;
- } while (--tries > 0);
- drawOrder(curve, defaultT, label);
+function drawVisibleOrder(curve, label) { + var s = pt_at_t(curve, 0); + var e = pt_at_t(curve, 1); + var sOn = ptOnScreen(s); + var eOn = ptOnScreen(e); + var defaultT = 0.85; + if (sOn && eOn) + return drawOrder(curve, defaultT, label); + if (sOn || eOn) { + if (eOn) { + defaultT = 1 - defaultT; + } + var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2; + var t = defaultT; + var tries = 16; + do { + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawOrder(curve, t, label); + t += step; + step /= 2; + } while (--tries > 0); + drawOrder(curve, defaultT, label); + } + // scattershot until we find a visible point + var denom = 2; // visit odd number num / denom to hit unique pts + var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ... + do { + for (var numer = 1; numer < denom; numer += 2) { + var t = numer / denom + 0.1; + if (t >= 1) { + break; + } + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawOrder(curve, t, label); + } + denom *= 2; + } while (--tries > 0); + drawOrder(curve, defaultT, label); } -function set_length(pt, newLen) {
- var len = Math.sqrt(pt.x * pt.x + pt.y * pt.y);
- var scale = newLen / len;
- var newPt = { x: pt.x * scale, y: pt.y * scale };
- return newPt;
+function set_length(pt, newLen) { + var len = Math.sqrt(pt.x * pt.x + pt.y * pt.y); + var scale = newLen / len; + var newPt = { x: pt.x * scale, y: pt.y * scale }; + return newPt; } -function drawDirection(curve, t) {
+function drawDirection(curve, t) { var d = dpt_at_t(curve, t); d = set_length(d, 16); - var pt = localToGlobal(pt_at_t(curve, t));
+ var pt = localToGlobal(pt_at_t(curve, t)); ctx.beginPath(); ctx.moveTo(pt.x - d.y, pt.y + d.x); ctx.lineTo(pt.x + d.x, pt.y + d.y); @@ -2438,47 +2438,47 @@ function drawDirection(curve, t) { ctx.stroke(); } -function drawVisibleDirection(curve) {
- var s = pt_at_t(curve, 0);
- var e = pt_at_t(curve, 1);
- var sOn = ptOnScreen(s);
- var eOn = ptOnScreen(e);
- var defaultT = 0.65;
- if (sOn && eOn) {
- return drawDirection(curve, defaultT);
- }
- if (sOn || eOn) {
- if (eOn) {
- defaultT = 1 - defaultT;
- }
- var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2;
- var t = defaultT;
- var tries = 16;
- do {
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawDirection(curve, t);
- t += step;
- step /= 2;
- } while (--tries > 0);
- drawDirection(curve, defaultT);
- }
- // scattershot until we find a visible point
- var denom = 2; // visit odd number num / denom to hit unique pts
- var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ...
- do {
- for (var numer = 1; numer < denom; numer += 2) {
- var t = numer / denom + 0.1;
- if (t >= 1) {
- break;
- }
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawDirection(curve, t);
- }
- denom *= 2;
- } while (--tries > 0);
- drawDirection(curve, defaultT);
+function drawVisibleDirection(curve) { + var s = pt_at_t(curve, 0); + var e = pt_at_t(curve, 1); + var sOn = ptOnScreen(s); + var eOn = ptOnScreen(e); + var defaultT = 0.65; + if (sOn && eOn) { + return drawDirection(curve, defaultT); + } + if (sOn || eOn) { + if (eOn) { + defaultT = 1 - defaultT; + } + var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2; + var t = defaultT; + var tries = 16; + do { + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawDirection(curve, t); + t += step; + step /= 2; + } while (--tries > 0); + drawDirection(curve, defaultT); + } + // scattershot until we find a visible point + var denom = 2; // visit odd number num / denom to hit unique pts + var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ... + do { + for (var numer = 1; numer < denom; numer += 2) { + var t = numer / denom + 0.1; + if (t >= 1) { + break; + } + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawDirection(curve, t); + } + denom *= 2; + } while (--tries > 0); + drawDirection(curve, defaultT); } function drawID(curve, t, id) { @@ -2489,53 +2489,53 @@ function drawID(curve, t, id) { draw_id_at(id, _px, _py); } -function localToGlobal(local) {
- var global = {};
- global.x = (local.x - srcLeft) * scale;
- global.y = (local.y - srcTop) * scale;
- return global;
+function localToGlobal(local) { + var global = {}; + global.x = (local.x - srcLeft) * scale; + global.y = (local.y - srcTop) * scale; + return global; } -function ptOnScreen(local) {
- var pt = localToGlobal(local);
- return 10 <= pt.x && pt.x <= screenWidth - 10
- && 10 <= pt.y && pt.y <= screenHeight - 10;
+function ptOnScreen(local) { + var pt = localToGlobal(local); + return 10 <= pt.x && pt.x <= screenWidth - 10 + && 10 <= pt.y && pt.y <= screenHeight - 10; } -function drawVisibleID(curve, defaultT, id) {
- // determine if either or both ends are visible
- var s = pt_at_t(curve, 0);
- var e = pt_at_t(curve, 1);
- var sOn = ptOnScreen(s);
- var eOn = ptOnScreen(e);
- if (sOn && eOn)
- return drawID(curve, defaultT, id);
- if (sOn || eOn) {
- var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2;
- var t = defaultT;
- var tries = 16;
- do {
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawID(curve, t, id);
- t += step;
- step /= 2;
- } while (--tries > 0);
- drawID(curve, defaultT, id);
- }
- // scattershot until we find a visible point
- var denom = 2; // visit odd number num / denom to hit unique pts
- var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ...
- do {
- for (var numer = 1; numer < denom; numer += 2) {
- var t = numer / denom;
- var mid = pt_at_t(curve, t);
- if (ptOnScreen(mid))
- return drawID(curve, t, id);
- }
- denom *= 2;
- } while (--tries > 0);
- drawID(curve, defaultT, id);
+function drawVisibleID(curve, defaultT, id) { + // determine if either or both ends are visible + var s = pt_at_t(curve, 0); + var e = pt_at_t(curve, 1); + var sOn = ptOnScreen(s); + var eOn = ptOnScreen(e); + if (sOn && eOn) + return drawID(curve, defaultT, id); + if (sOn || eOn) { + var step = sOn ? -defaultT / 2 : (1 - defaultT) / 2; + var t = defaultT; + var tries = 16; + do { + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawID(curve, t, id); + t += step; + step /= 2; + } while (--tries > 0); + drawID(curve, defaultT, id); + } + // scattershot until we find a visible point + var denom = 2; // visit odd number num / denom to hit unique pts + var tries = 6; // tries 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16 ... + do { + for (var numer = 1; numer < denom; numer += 2) { + var t = numer / denom; + var mid = pt_at_t(curve, t); + if (ptOnScreen(mid)) + return drawID(curve, t, id); + } + denom *= 2; + } while (--tries > 0); + drawID(curve, defaultT, id); } function draw_id_at(id, _px, _py) { @@ -2613,8 +2613,8 @@ function drawCurveSpecials(test, curve, type) { drawVisibleID(curve, 0.5, id); } } - if (draw_direction) {
- drawVisibleDirection(curve);
+ if (draw_direction) { + drawVisibleDirection(curve); } if (type == PATH_LINE) { return; @@ -3205,10 +3205,10 @@ function draw(test, lines, title) { drawVisibleOrder(leftCurve, 'L'); drawVisibleOrder(rightCurve, 'R'); } - if (draw_id) {
- drawVisibleID(leftCurve, 0.5, frags[0]);
- drawVisibleID(midCurve, 0.5, frags[6]);
- drawVisibleID(rightCurve, 0.5, frags[12]);
+ if (draw_id) { + drawVisibleID(leftCurve, 0.5, frags[0]); + drawVisibleID(midCurve, 0.5, frags[6]); + drawVisibleID(rightCurve, 0.5, frags[12]); } break; case REC_TYPE_AFTERPART: @@ -3245,8 +3245,8 @@ function draw(test, lines, title) { throw "stop execution"; } drawCurve(curve); - if (draw_id) {
- drawVisibleID(curve, 0.5, id);
+ if (draw_id) { + drawVisibleID(curve, 0.5, id); } ++afterIndex; break; |