| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "../src/image/SkImagePriv.h" | 8 #include "../src/image/SkImagePriv.h" |
| 9 #include "../src/image/SkSurface_Base.h" | 9 #include "../src/image/SkSurface_Base.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| 11 #include "SkBitmapDevice.h" | |
| 12 #include "SkBitmapProcShader.h" | 11 #include "SkBitmapProcShader.h" |
| 13 #include "SkDeferredCanvas.h" | 12 #include "SkDeferredCanvas.h" |
| 14 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
| 15 #include "SkShader.h" | 14 #include "SkShader.h" |
| 16 #include "SkSurface.h" | 15 #include "SkSurface.h" |
| 17 #include "Test.h" | 16 #include "Test.h" |
| 18 #include "sk_tool_utils.h" | 17 #include "sk_tool_utils.h" |
| 19 | 18 |
| 20 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
| 21 #include "GrContextFactory.h" | 20 #include "GrContextFactory.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 { | 432 { |
| 434 SkPaint paint; | 433 SkPaint paint; |
| 435 paint.setStyle(SkPaint::kFill_Style); | 434 paint.setStyle(SkPaint::kFill_Style); |
| 436 paint.setAlpha(100); | 435 paint.setAlpha(100); |
| 437 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 436 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 438 canvas->drawRect(fullRect, paint); | 437 canvas->drawRect(fullRect, paint); |
| 439 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 438 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 440 } | 439 } |
| 441 } | 440 } |
| 442 | 441 |
| 443 class MockDevice : public SkBitmapDevice { | |
| 444 public: | |
| 445 MockDevice(const SkBitmap& bm) : SkBitmapDevice(bm) { | |
| 446 fDrawBitmapCallCount = 0; | |
| 447 } | |
| 448 virtual void drawBitmap(const SkDraw&, const SkBitmap&, | |
| 449 const SkMatrix&, const SkPaint&) override { | |
| 450 fDrawBitmapCallCount++; | |
| 451 } | |
| 452 | |
| 453 int fDrawBitmapCallCount; | |
| 454 }; | |
| 455 | |
| 456 class NotificationCounter : public SkDeferredCanvas::NotificationClient { | 442 class NotificationCounter : public SkDeferredCanvas::NotificationClient { |
| 457 public: | 443 public: |
| 458 NotificationCounter() { | 444 NotificationCounter() { |
| 459 fPrepareForDrawCount = fStorageAllocatedChangedCount = | 445 fPrepareForDrawCount = fStorageAllocatedChangedCount = |
| 460 fFlushedDrawCommandsCount = fSkippedPendingDrawCommandsCount = 0; | 446 fFlushedDrawCommandsCount = fSkippedPendingDrawCommandsCount = 0; |
| 461 } | 447 } |
| 462 | 448 |
| 463 void prepareForDraw() override { | 449 void prepareForDraw() override { |
| 464 fPrepareForDrawCount++; | 450 fPrepareForDrawCount++; |
| 465 } | 451 } |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 TestDeferredCanvasSurface(reporter, NULL); | 939 TestDeferredCanvasSurface(reporter, NULL); |
| 954 TestDeferredCanvasSetSurface(reporter, NULL); | 940 TestDeferredCanvasSetSurface(reporter, NULL); |
| 955 } | 941 } |
| 956 | 942 |
| 957 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 943 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
| 958 if (factory != NULL) { | 944 if (factory != NULL) { |
| 959 TestDeferredCanvasSurface(reporter, factory); | 945 TestDeferredCanvasSurface(reporter, factory); |
| 960 TestDeferredCanvasSetSurface(reporter, factory); | 946 TestDeferredCanvasSetSurface(reporter, factory); |
| 961 } | 947 } |
| 962 } | 948 } |
| OLD | NEW |