| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkDeferredCanvas.h" | 9 #include "SkDeferredCanvas.h" |
| 10 | 10 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 virtual SkImageInfo imageInfo() const SK_OVERRIDE; | 164 virtual SkImageInfo imageInfo() const SK_OVERRIDE; |
| 165 | 165 |
| 166 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE; | 166 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE; |
| 167 | 167 |
| 168 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; | 168 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; |
| 169 | 169 |
| 170 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; | 170 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; |
| 171 | 171 |
| 172 protected: | 172 protected: |
| 173 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 173 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; |
| 174 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | |
| 175 virtual bool onReadPixels(const SkBitmap& bitmap, | |
| 176 int x, int y, | |
| 177 SkCanvas::Config8888 config8888) SK_OVERRIDE; | |
| 178 #endif | |
| 179 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; | 174 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; |
| 180 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; | 175 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; |
| 181 | 176 |
| 182 // The following methods are no-ops on a deferred device | 177 // The following methods are no-ops on a deferred device |
| 183 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { | 178 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { |
| 184 return false; | 179 return false; |
| 185 } | 180 } |
| 186 | 181 |
| 187 // None of the following drawing methods should ever get called on the | 182 // None of the following drawing methods should ever get called on the |
| 188 // deferred device | 183 // deferred device |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // will not be used with a deferred canvas (there is no API for that). | 497 // will not be used with a deferred canvas (there is no API for that). |
| 503 // And connecting a SkDeferredDevice to non-deferred canvas can result | 498 // And connecting a SkDeferredDevice to non-deferred canvas can result |
| 504 // in unpredictable behavior. | 499 // in unpredictable behavior. |
| 505 return immediateDevice()->createCompatibleDevice(info); | 500 return immediateDevice()->createCompatibleDevice(info); |
| 506 } | 501 } |
| 507 | 502 |
| 508 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info) { | 503 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info) { |
| 509 return this->immediateDevice()->newSurface(info); | 504 return this->immediateDevice()->newSurface(info); |
| 510 } | 505 } |
| 511 | 506 |
| 512 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG | |
| 513 bool SkDeferredDevice::onReadPixels( | |
| 514 const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) { | |
| 515 this->flushPendingCommands(kNormal_PlaybackMode); | |
| 516 return fImmediateCanvas->readPixels(const_cast<SkBitmap*>(&bitmap), | |
| 517 x, y, config8888); | |
| 518 } | |
| 519 #endif | |
| 520 | |
| 521 bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_
t rowBytes, | 507 bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_
t rowBytes, |
| 522 int x, int y) { | 508 int x, int y) { |
| 523 this->flushPendingCommands(kNormal_PlaybackMode); | 509 this->flushPendingCommands(kNormal_PlaybackMode); |
| 524 return fImmediateCanvas->readPixels(info, pixels, rowBytes, x, y); | 510 return fImmediateCanvas->readPixels(info, pixels, rowBytes, x, y); |
| 525 } | 511 } |
| 526 | 512 |
| 527 class AutoImmediateDrawIfNeeded { | 513 class AutoImmediateDrawIfNeeded { |
| 528 public: | 514 public: |
| 529 AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap, | 515 AutoImmediateDrawIfNeeded(SkDeferredCanvas& canvas, const SkBitmap* bitmap, |
| 530 const SkPaint* paint) { | 516 const SkPaint* paint) { |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 984 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 999 this->drawingCanvas()->setDrawFilter(filter); | 985 this->drawingCanvas()->setDrawFilter(filter); |
| 1000 this->INHERITED::setDrawFilter(filter); | 986 this->INHERITED::setDrawFilter(filter); |
| 1001 this->recordedDrawCommand(); | 987 this->recordedDrawCommand(); |
| 1002 return filter; | 988 return filter; |
| 1003 } | 989 } |
| 1004 | 990 |
| 1005 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 991 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
| 1006 return this->drawingCanvas(); | 992 return this->drawingCanvas(); |
| 1007 } | 993 } |
| OLD | NEW |