Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/utils/SkDeferredCanvas.cpp

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add new file Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ports/SkImageDecoder_CG.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void skipPendingCommands(); 154 void skipPendingCommands();
155 void setMaxRecordingStorage(size_t); 155 void setMaxRecordingStorage(size_t);
156 void recordedDrawCommand(); 156 void recordedDrawCommand();
157 157
158 virtual SkImageInfo imageInfo() const SK_OVERRIDE; 158 virtual SkImageInfo imageInfo() const SK_OVERRIDE;
159 159
160 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE; 160 virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
161 161
162 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; 162 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
163 163
164 virtual SkSurface* newSurface(const SkImageInfo&) 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 171 // The following methods are no-ops on a deferred device
172 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { 172 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
173 return false; 173 return false;
174 } 174 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 // Save layer usage not supported, and not required by SkDeferredCanvas. 467 // Save layer usage not supported, and not required by SkDeferredCanvas.
468 SkASSERT(usage != kSaveLayer_Usage); 468 SkASSERT(usage != kSaveLayer_Usage);
469 // Create a compatible non-deferred device. 469 // Create a compatible non-deferred device.
470 // We do not create a deferred device because we know the new device 470 // 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). 471 // 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 472 // And connecting a SkDeferredDevice to non-deferred canvas can result
473 // in unpredictable behavior. 473 // in unpredictable behavior.
474 return immediateDevice()->createCompatibleDevice(info); 474 return immediateDevice()->createCompatibleDevice(info);
475 } 475 }
476 476
477 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info) { 477 SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info, const SkSurface Props& props) {
478 return this->immediateDevice()->newSurface(info); 478 return this->immediateDevice()->newSurface(info, props);
479 } 479 }
480 480
481 bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_ t rowBytes, 481 bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_ t rowBytes,
482 int x, int y) { 482 int x, int y) {
483 this->flushPendingCommands(kNormal_PlaybackMode); 483 this->flushPendingCommands(kNormal_PlaybackMode);
484 return fImmediateCanvas->readPixels(info, pixels, rowBytes, x, y); 484 return fImmediateCanvas->readPixels(info, pixels, rowBytes, x, y);
485 } 485 }
486 486
487 class AutoImmediateDrawIfNeeded { 487 class AutoImmediateDrawIfNeeded {
488 public: 488 public:
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 948 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
949 this->drawingCanvas()->setDrawFilter(filter); 949 this->drawingCanvas()->setDrawFilter(filter);
950 this->INHERITED::setDrawFilter(filter); 950 this->INHERITED::setDrawFilter(filter);
951 this->recordedDrawCommand(); 951 this->recordedDrawCommand();
952 return filter; 952 return filter;
953 } 953 }
954 954
955 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 955 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
956 return this->drawingCanvas(); 956 return this->drawingCanvas();
957 } 957 }
OLDNEW
« no previous file with comments | « src/ports/SkImageDecoder_CG.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698