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

Unified Diff: samplecode/SampleApp.cpp

Issue 2120333002: deferred canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: override drawTextRSXform Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/utils/SkDeferredCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index a1e42e3aacd76f4eb552f77c4a930cc2f793847e..ffa507bc17d519d15c7b31f3c872b5ae22004da3 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -804,6 +804,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fRequestGrabImage = false;
fTilingMode = kNo_Tiling;
fMeasureFPS = false;
+ fUseDeferredCanvas = false;
fLCDState = SkOSMenu::kMixedState;
fAAState = SkOSMenu::kMixedState;
fSubpixelState = SkOSMenu::kMixedState;
@@ -987,6 +988,9 @@ static void drawText(SkCanvas* canvas, SkString str, SkScalar left, SkScalar top
#define XCLIP_N 8
#define YCLIP_N 8
+#include "SkDeferredCanvas.h"
+#include "SkDumpCanvas.h"
+
void SampleWindow::draw(SkCanvas* canvas) {
gAnimTimer.updateTime();
@@ -1001,7 +1005,11 @@ void SampleWindow::draw(SkCanvas* canvas) {
SkSize tile = this->tileSize();
if (kNo_Tiling == fTilingMode) {
- this->INHERITED::draw(canvas); // no looping or surfaces needed
+ SkDebugfDumper dumper;
+ SkDumpCanvas dump(&dumper);
+ SkDeferredCanvas deferred(canvas);
+ SkCanvas* c = fUseDeferredCanvas ? &deferred : canvas;
+ this->INHERITED::draw(c); // no looping or surfaces needed
} else {
const SkScalar w = SkScalarCeilToScalar(tile.width());
const SkScalar h = SkScalarCeilToScalar(tile.height());
@@ -1667,6 +1675,10 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
case 'D':
toggleDistanceFieldFonts();
break;
+ case 'E':
+ fUseDeferredCanvas = !fUseDeferredCanvas;
+ this->inval(nullptr);
+ break;
case 'f':
// only
toggleFPS();
@@ -2020,6 +2032,9 @@ void SampleWindow::updateTitle() {
if (fUsePicture) {
title.prepend("<P> ");
}
+ if (fUseDeferredCanvas) {
+ title.prepend("<E> ");
+ }
title.prepend(trystate_str(fLCDState, "LCD ", "lcd "));
title.prepend(trystate_str(fAAState, "AA ", "aa "));
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698