| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 SkDeferredCanvas::NotificationClient* notificationClient) { | 317 SkDeferredCanvas::NotificationClient* notificationClient) { |
| 318 fNotificationClient = notificationClient; | 318 fNotificationClient = notificationClient; |
| 319 } | 319 } |
| 320 | 320 |
| 321 void SkDeferredDevice::skipPendingCommands() { | 321 void SkDeferredDevice::skipPendingCommands() { |
| 322 if (!fRecordingCanvas->isDrawingToLayer()) { | 322 if (!fRecordingCanvas->isDrawingToLayer()) { |
| 323 fCanDiscardCanvasContents = true; | 323 fCanDiscardCanvasContents = true; |
| 324 if (fPipeController.hasPendingCommands()) { | 324 if (fPipeController.hasPendingCommands()) { |
| 325 fFreshFrame = true; | 325 fFreshFrame = true; |
| 326 flushPendingCommands(kSilent_PlaybackMode); | 326 flushPendingCommands(kSilent_PlaybackMode); |
| 327 if (fNotificationClient) { | |
| 328 fNotificationClient->skippedPendingDrawCommands(); | |
| 329 } | |
| 330 } | 327 } |
| 331 } | 328 } |
| 332 } | 329 } |
| 333 | 330 |
| 334 bool SkDeferredDevice::isFreshFrame() { | 331 bool SkDeferredDevice::isFreshFrame() { |
| 335 bool ret = fFreshFrame; | 332 bool ret = fFreshFrame; |
| 336 fFreshFrame = false; | 333 fFreshFrame = false; |
| 337 return ret; | 334 return ret; |
| 338 } | 335 } |
| 339 | 336 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 356 | 353 |
| 357 void SkDeferredDevice::flushPendingCommands(PlaybackMode playbackMode) { | 354 void SkDeferredDevice::flushPendingCommands(PlaybackMode playbackMode) { |
| 358 if (!fPipeController.hasPendingCommands()) { | 355 if (!fPipeController.hasPendingCommands()) { |
| 359 return; | 356 return; |
| 360 } | 357 } |
| 361 if (playbackMode == kNormal_PlaybackMode) { | 358 if (playbackMode == kNormal_PlaybackMode) { |
| 362 aboutToDraw(); | 359 aboutToDraw(); |
| 363 } | 360 } |
| 364 fPipeWriter.flushRecording(true); | 361 fPipeWriter.flushRecording(true); |
| 365 fPipeController.playback(kSilent_PlaybackMode == playbackMode); | 362 fPipeController.playback(kSilent_PlaybackMode == playbackMode); |
| 366 if (playbackMode == kNormal_PlaybackMode && fNotificationClient) { | 363 if (fNotificationClient) { |
| 367 fNotificationClient->flushedDrawCommands(); | 364 if (playbackMode == kSilent_PlaybackMode) { |
| 365 fNotificationClient->skippedPendingDrawCommands(); |
| 366 } else { |
| 367 fNotificationClient->flushedDrawCommands(); |
| 368 } |
| 368 } | 369 } |
| 370 |
| 369 fPreviousStorageAllocated = storageAllocatedForRecording(); | 371 fPreviousStorageAllocated = storageAllocatedForRecording(); |
| 370 } | 372 } |
| 371 | 373 |
| 372 void SkDeferredDevice::flush() { | 374 void SkDeferredDevice::flush() { |
| 373 this->flushPendingCommands(kNormal_PlaybackMode); | 375 this->flushPendingCommands(kNormal_PlaybackMode); |
| 374 fImmediateCanvas->flush(); | 376 fImmediateCanvas->flush(); |
| 375 } | 377 } |
| 376 | 378 |
| 377 size_t SkDeferredDevice::freeMemoryIfPossible(size_t bytesToFree) { | 379 size_t SkDeferredDevice::freeMemoryIfPossible(size_t bytesToFree) { |
| 378 size_t val = fPipeWriter.freeMemoryIfPossible(bytesToFree); | 380 size_t val = fPipeWriter.freeMemoryIfPossible(bytesToFree); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { | 962 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 961 this->drawingCanvas()->setDrawFilter(filter); | 963 this->drawingCanvas()->setDrawFilter(filter); |
| 962 this->INHERITED::setDrawFilter(filter); | 964 this->INHERITED::setDrawFilter(filter); |
| 963 this->recordedDrawCommand(); | 965 this->recordedDrawCommand(); |
| 964 return filter; | 966 return filter; |
| 965 } | 967 } |
| 966 | 968 |
| 967 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { | 969 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { |
| 968 return this->drawingCanvas(); | 970 return this->drawingCanvas(); |
| 969 } | 971 } |
| OLD | NEW |