| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SkPaint paint; | 115 SkPaint paint; |
| 116 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 116 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 117 canvas->drawBitmap(make_src_bitmap(), 0, 0, &paint); | 117 canvas->drawBitmap(make_src_bitmap(), 0, 0, &paint); |
| 118 canvas->restore(); | 118 canvas->restore(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 #if SK_SUPPORT_GPU | 121 #if SK_SUPPORT_GPU |
| 122 static void fill_src_texture(GrTexture* texture) { | 122 static void fill_src_texture(GrTexture* texture) { |
| 123 SkBitmap bmp = make_src_bitmap(); | 123 SkBitmap bmp = make_src_bitmap(); |
| 124 bmp.lockPixels(); | 124 bmp.lockPixels(); |
| 125 texture->writePixels(0, 0, DEV_W, DEV_H, kSkia8888_GrPixelConfig, bmp.getPix
els(), | 125 texture->writePixels(NULL, 0, 0, DEV_W, DEV_H, kSkia8888_GrPixelConfig, bmp.
getPixels(), |
| 126 bmp.rowBytes()); | 126 bmp.rowBytes()); |
| 127 texture->setFromRawPixels(true); |
| 128 texture->setException(true); |
| 127 bmp.unlockPixels(); | 129 bmp.unlockPixels(); |
| 128 } | 130 } |
| 129 #endif | 131 #endif |
| 130 | 132 |
| 131 static void fill_dst_bmp_with_init_data(SkBitmap* bitmap) { | 133 static void fill_dst_bmp_with_init_data(SkBitmap* bitmap) { |
| 132 SkASSERT(bitmap->lockPixelsAreWritable()); | 134 SkASSERT(bitmap->lockPixelsAreWritable()); |
| 133 SkAutoLockPixels alp(*bitmap); | 135 SkAutoLockPixels alp(*bitmap); |
| 134 int w = bitmap->width(); | 136 int w = bitmap->width(); |
| 135 int h = bitmap->height(); | 137 int h = bitmap->height(); |
| 136 intptr_t pixels = reinterpret_cast<intptr_t>(bitmap->getPixels()); | 138 intptr_t pixels = reinterpret_cast<intptr_t>(bitmap->getPixels()); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; | 609 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; |
| 608 | 610 |
| 609 REPORTER_ASSERT(reporter, dataA->equals(dataB)); | 611 REPORTER_ASSERT(reporter, dataA->equals(dataB)); |
| 610 if (false) { | 612 if (false) { |
| 611 dump_to_file("test_image_A.png", dataA); | 613 dump_to_file("test_image_A.png", dataA); |
| 612 dump_to_file("test_image_B.png", dataB); | 614 dump_to_file("test_image_B.png", dataB); |
| 613 } | 615 } |
| 614 } | 616 } |
| 615 } | 617 } |
| 616 #endif | 618 #endif |
| OLD | NEW |