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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 fImmediateCanvas->flush(); | 439 fImmediateCanvas->flush(); |
440 } | 440 } |
441 | 441 |
442 bool SkDeferredDevice::onWritePixels(const SkImageInfo& info, const void* pixels
, size_t rowBytes, | 442 bool SkDeferredDevice::onWritePixels(const SkImageInfo& info, const void* pixels
, size_t rowBytes, |
443 int x, int y) { | 443 int x, int y) { |
444 SkASSERT(x >= 0 && y >= 0); | 444 SkASSERT(x >= 0 && y >= 0); |
445 SkASSERT(x + info.width() <= width()); | 445 SkASSERT(x + info.width() <= width()); |
446 SkASSERT(y + info.height() <= height()); | 446 SkASSERT(y + info.height() <= height()); |
447 | 447 |
448 this->flushPendingCommands(kNormal_PlaybackMode); | |
449 | |
450 const SkImageInfo deviceInfo = this->imageInfo(); | 448 const SkImageInfo deviceInfo = this->imageInfo(); |
451 if (info.width() == deviceInfo.width() && info.height() == deviceInfo.height
()) { | 449 if (info.width() == deviceInfo.width() && info.height() == deviceInfo.height
()) { |
452 this->skipPendingCommands(); | 450 this->skipPendingCommands(); |
| 451 } else { |
| 452 this->flushPendingCommands(kNormal_PlaybackMode); |
453 } | 453 } |
454 | 454 |
455 this->prepareForImmediatePixelWrite(); | 455 this->prepareForImmediatePixelWrite(); |
456 return immediateDevice()->onWritePixels(info, pixels, rowBytes, x, y); | 456 return immediateDevice()->onWritePixels(info, pixels, rowBytes, x, y); |
457 } | 457 } |
458 | 458 |
459 const SkBitmap& SkDeferredDevice::onAccessBitmap() { | 459 const SkBitmap& SkDeferredDevice::onAccessBitmap() { |
460 this->flushPendingCommands(kNormal_PlaybackMode); | 460 this->flushPendingCommands(kNormal_PlaybackMode); |
461 return immediateDevice()->accessBitmap(false); | 461 return immediateDevice()->accessBitmap(false); |
462 } | 462 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 934 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
935 this->drawingCanvas()->setDrawFilter(filter); | 935 this->drawingCanvas()->setDrawFilter(filter); |
936 this->INHERITED::setDrawFilter(filter); | 936 this->INHERITED::setDrawFilter(filter); |
937 this->recordedDrawCommand(); | 937 this->recordedDrawCommand(); |
938 return filter; | 938 return filter; |
939 } | 939 } |
940 | 940 |
941 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 941 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
942 return this->drawingCanvas(); | 942 return this->drawingCanvas(); |
943 } | 943 } |
OLD | NEW |