bool isFreshFrame() const;
/**
+ * Returns true if the canvas has recorded draw commands that have
+ * not yet been played back.
+ */
+ bool hasPendingCommands() const;
+
+ /**
* Specify the maximum number of bytes to be allocated for the purpose
* of recording draw commands to this canvas. The default limit, is
* 64MB.
virtual void* requestBlock(size_t minRequest, size_t* actual) SK_OVERRIDE;
virtual void notifyWritten(size_t bytes) SK_OVERRIDE;
void playback(bool silent);
- bool hasRecorded() const { return fAllocator.blockCount() != 0; }
+ bool hasPendingCommands() const { return fAllocator.blockCount() != 0; }
size_t storageAllocatedForRecording() const { return fAllocator.totalCapacity(); }
private:
enum {
SkCanvas* immediateCanvas() const {return fImmediateCanvas;}
SkDevice* immediateDevice() const {return fImmediateDevice;}
bool isFreshFrame();
+ bool hasPendingCommands();
size_t storageAllocatedForRecording() const;
size_t freeMemoryIfPossible(size_t bytesToFree);
void flushPendingCommands(PlaybackMode);
}
void DeferredDevice::skipPendingCommands() {
- if (!fRecordingCanvas->isDrawingToLayer() && fPipeController.hasRecorded()) {
+ if (!fRecordingCanvas->isDrawingToLayer() && fPipeController.hasPendingCommands()) {
fFreshFrame = true;
flushPendingCommands(kSilent_PlaybackMode);
}
return ret;
}
+bool DeferredDevice::hasPendingCommands() {
+ return fPipeController.hasPendingCommands();
+}
+
void DeferredDevice::flushPendingCommands(PlaybackMode playbackMode) {
- if (!fPipeController.hasRecorded()) {
+ if (!fPipeController.hasPendingCommands()) {
return;
}
if (playbackMode == kNormal_PlaybackMode && fNotificationClient) {
return this->getDeferredDevice()->isFreshFrame();
}
+bool SkDeferredCanvas::hasPendingCommands() const {
+ return this->getDeferredDevice()->hasPendingCommands();
+}
+
void SkDeferredCanvas::silentFlush() {
if (fDeferredDrawing) {
this->getDeferredDevice()->flushPendingCommands(kSilent_PlaybackMode);