Chromium Code Reviews| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 fNotificationClient->flushedDrawCommands(); | 363 fNotificationClient->flushedDrawCommands(); |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 fPreviousStorageAllocated = storageAllocatedForRecording(); | 367 fPreviousStorageAllocated = storageAllocatedForRecording(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void SkDeferredDevice::flush() { | 370 void SkDeferredDevice::flush() { |
| 371 this->flushPendingCommands(kNormal_PlaybackMode); | 371 this->flushPendingCommands(kNormal_PlaybackMode); |
| 372 fImmediateCanvas->flush(); | 372 fImmediateCanvas->flush(); |
| 373 fFreshFrame = true; | |
| 373 } | 374 } |
| 374 | 375 |
| 375 size_t SkDeferredDevice::freeMemoryIfPossible(size_t bytesToFree) { | 376 size_t SkDeferredDevice::freeMemoryIfPossible(size_t bytesToFree) { |
| 376 size_t val = fPipeWriter.freeMemoryIfPossible(bytesToFree); | 377 size_t val = fPipeWriter.freeMemoryIfPossible(bytesToFree); |
| 377 fPreviousStorageAllocated = storageAllocatedForRecording(); | 378 fPreviousStorageAllocated = storageAllocatedForRecording(); |
| 378 return val; | 379 return val; |
| 379 } | 380 } |
| 380 | 381 |
| 381 size_t SkDeferredDevice::storageAllocatedForRecording() const { | 382 size_t SkDeferredDevice::storageAllocatedForRecording() const { |
| 382 return (fPipeController.storageAllocatedForRecording() | 383 return (fPipeController.storageAllocatedForRecording() |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 return notificationClient; | 624 return notificationClient; |
| 624 } | 625 } |
| 625 | 626 |
| 626 SkImage* SkDeferredCanvas::newImageSnapshot() { | 627 SkImage* SkDeferredCanvas::newImageSnapshot() { |
| 627 SkDeferredDevice* deferredDevice = this->getDeferredDevice(); | 628 SkDeferredDevice* deferredDevice = this->getDeferredDevice(); |
| 628 SkASSERT(deferredDevice); | 629 SkASSERT(deferredDevice); |
| 629 return deferredDevice ? deferredDevice->newImageSnapshot() : NULL; | 630 return deferredDevice ? deferredDevice->newImageSnapshot() : NULL; |
| 630 } | 631 } |
| 631 | 632 |
| 632 bool SkDeferredCanvas::isFullFrame(const SkRect* rect, | 633 bool SkDeferredCanvas::isFullFrame(const SkRect* rect, |
| 633 const SkPaint* paint) const { | 634 const SkPaint* paint) { |
| 634 SkCanvas* canvas = this->drawingCanvas(); | 635 SkCanvas* canvas = this->drawingCanvas(); |
| 635 SkISize canvasSize = this->getDeviceSize(); | 636 if (isFreshFrame()) { |
|
yunchao
2014/09/05 08:43:13
maybe I should implement a new method named isNewF
reed1
2014/09/05 13:18:33
nit: this->isFreshFrame()
Justin Novosad
2014/09/05 13:54:49
isFreshFrame is not the right condition for refres
yunchao
2014/09/09 08:58:00
Done.
yunchao
2014/09/09 08:58:00
Done. Added a new interface SkDeferredCanvas::canv
| |
| 637 canvasSize = this->getDeviceSize(); | |
| 638 } | |
| 636 if (rect) { | 639 if (rect) { |
| 637 if (!canvas->getTotalMatrix().rectStaysRect()) { | 640 if (!canvas->getTotalMatrix().rectStaysRect()) { |
| 638 return false; // conservative | 641 return false; // conservative |
| 639 } | 642 } |
| 640 | 643 |
| 641 SkRect transformedRect; | 644 SkRect transformedRect; |
| 642 canvas->getTotalMatrix().mapRect(&transformedRect, *rect); | 645 canvas->getTotalMatrix().mapRect(&transformedRect, *rect); |
| 643 | 646 |
| 644 if (paint) { | 647 if (paint) { |
| 645 SkPaint::Style paintStyle = paint->getStyle(); | 648 SkPaint::Style paintStyle = paint->getStyle(); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 940 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 938 this->drawingCanvas()->setDrawFilter(filter); | 941 this->drawingCanvas()->setDrawFilter(filter); |
| 939 this->INHERITED::setDrawFilter(filter); | 942 this->INHERITED::setDrawFilter(filter); |
| 940 this->recordedDrawCommand(); | 943 this->recordedDrawCommand(); |
| 941 return filter; | 944 return filter; |
| 942 } | 945 } |
| 943 | 946 |
| 944 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 947 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
| 945 return this->drawingCanvas(); | 948 return this->drawingCanvas(); |
| 946 } | 949 } |
| OLD | NEW |