| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRID
E; | 162 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRID
E; |
| 163 | 163 |
| 164 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_
OVERRIDE; | 164 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_
OVERRIDE; |
| 165 | 165 |
| 166 protected: | 166 protected: |
| 167 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 167 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; |
| 168 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; | 168 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; |
| 169 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; | 169 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y) SK_OVERRIDE; |
| 170 | 170 |
| 171 // The following methods are no-ops on a deferred device | |
| 172 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { | |
| 173 return false; | |
| 174 } | |
| 175 | |
| 176 // None of the following drawing methods should ever get called on the | 171 // None of the following drawing methods should ever get called on the |
| 177 // deferred device | 172 // deferred device |
| 178 virtual void clear(SkColor color) SK_OVERRIDE | 173 virtual void clear(SkColor color) SK_OVERRIDE |
| 179 {SkASSERT(0);} | 174 {SkASSERT(0);} |
| 180 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE | 175 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE |
| 181 {SkASSERT(0);} | 176 {SkASSERT(0);} |
| 182 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, | 177 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, |
| 183 size_t count, const SkPoint[], | 178 size_t count, const SkPoint[], |
| 184 const SkPaint& paint) SK_OVERRIDE | 179 const SkPaint& paint) SK_OVERRIDE |
| 185 {SkASSERT(0);} | 180 {SkASSERT(0);} |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 454 } |
| 460 | 455 |
| 461 const SkBitmap& SkDeferredDevice::onAccessBitmap() { | 456 const SkBitmap& SkDeferredDevice::onAccessBitmap() { |
| 462 this->flushPendingCommands(kNormal_PlaybackMode); | 457 this->flushPendingCommands(kNormal_PlaybackMode); |
| 463 return immediateDevice()->accessBitmap(false); | 458 return immediateDevice()->accessBitmap(false); |
| 464 } | 459 } |
| 465 | 460 |
| 466 SkBaseDevice* SkDeferredDevice::onCreateCompatibleDevice(const CreateInfo& cinfo
) { | 461 SkBaseDevice* SkDeferredDevice::onCreateCompatibleDevice(const CreateInfo& cinfo
) { |
| 467 // Save layer usage not supported, and not required by SkDeferredCanvas. | 462 // Save layer usage not supported, and not required by SkDeferredCanvas. |
| 468 SkASSERT(cinfo.fUsage != kSaveLayer_Usage); | 463 SkASSERT(cinfo.fUsage != kSaveLayer_Usage); |
| 464 |
| 469 // Create a compatible non-deferred device. | 465 // Create a compatible non-deferred device. |
| 470 // We do not create a deferred device because we know the new device | 466 // We do not create a deferred device because we know the new device |
| 471 // will not be used with a deferred canvas (there is no API for that). | 467 // will not be used with a deferred canvas (there is no API for that). |
| 472 // And connecting a SkDeferredDevice to non-deferred canvas can result | 468 // And connecting a SkDeferredDevice to non-deferred canvas can result |
| 473 // in unpredictable behavior. | 469 // in unpredictable behavior. |
| 474 return immediateDevice()->onCreateCompatibleDevice(cinfo); | 470 return immediateDevice()->onCreateCompatibleDevice(cinfo); |
| 475 } | 471 } |
| 476 | 472 |
| 477 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info, const SkSurface
Props& props) { | 473 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info, const SkSurface
Props& props) { |
| 478 return this->immediateDevice()->newSurface(info, props); | 474 return this->immediateDevice()->newSurface(info, props); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 944 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 949 this->drawingCanvas()->setDrawFilter(filter); | 945 this->drawingCanvas()->setDrawFilter(filter); |
| 950 this->INHERITED::setDrawFilter(filter); | 946 this->INHERITED::setDrawFilter(filter); |
| 951 this->recordedDrawCommand(); | 947 this->recordedDrawCommand(); |
| 952 return filter; | 948 return filter; |
| 953 } | 949 } |
| 954 | 950 |
| 955 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 951 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
| 956 return this->drawingCanvas(); | 952 return this->drawingCanvas(); |
| 957 } | 953 } |
| OLD | NEW |