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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleApp.h ('k') | samplecode/SampleCircle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SampleApp.h" 7 #include "SampleApp.h"
8 8
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 fCurRenderTarget = NULL; 262 fCurRenderTarget = NULL;
263 #endif 263 #endif
264 win->detach(); 264 win->detach();
265 fBackend = kNone_BackEndType; 265 fBackend = kNone_BackEndType;
266 } 266 }
267 267
268 virtual SkCanvas* createCanvas(SampleWindow::DeviceType dType, 268 virtual SkCanvas* createCanvas(SampleWindow::DeviceType dType,
269 SampleWindow* win) { 269 SampleWindow* win) {
270 #if SK_SUPPORT_GPU 270 #if SK_SUPPORT_GPU
271 if (IsGpuDeviceType(dType) && NULL != fCurContext) { 271 if (IsGpuDeviceType(dType) && NULL != fCurContext) {
272 SkAutoTUnref<SkDevice> device(new SkGpuDevice(fCurContext, fCurRende rTarget)); 272 SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(fCurContext, fCurR enderTarget));
273 return new SkCanvas(device); 273 return new SkCanvas(device);
274 } else 274 } else
275 #endif 275 #endif
276 { 276 {
277 return NULL; 277 return NULL;
278 } 278 }
279 } 279 }
280 280
281 virtual void publishCanvas(SampleWindow::DeviceType dType, 281 virtual void publishCanvas(SampleWindow::DeviceType dType,
282 SkCanvas* canvas, 282 SkCanvas* canvas,
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1422
1423 // We took over the draw calls in order to create the PDF, so we need 1423 // We took over the draw calls in order to create the PDF, so we need
1424 // to redraw. 1424 // to redraw.
1425 this->inval(NULL); 1425 this->inval(NULL);
1426 return; 1426 return;
1427 } 1427 }
1428 1428
1429 if (fRequestGrabImage) { 1429 if (fRequestGrabImage) {
1430 fRequestGrabImage = false; 1430 fRequestGrabImage = false;
1431 1431
1432 SkDevice* device = orig->getDevice(); 1432 SkBaseDevice* device = orig->getDevice();
1433 SkBitmap bmp; 1433 SkBitmap bmp;
1434 if (device->accessBitmap(false).copyTo(&bmp, SkBitmap::kARGB_8888_Config )) { 1434 if (device->accessBitmap(false).copyTo(&bmp, SkBitmap::kARGB_8888_Config )) {
1435 static int gSampleGrabCounter; 1435 static int gSampleGrabCounter;
1436 SkString name; 1436 SkString name;
1437 name.printf("sample_grab_%d.png", gSampleGrabCounter++); 1437 name.printf("sample_grab_%d.png", gSampleGrabCounter++);
1438 SkImageEncoder::EncodeFile(name.c_str(), bmp, 1438 SkImageEncoder::EncodeFile(name.c_str(), bmp,
1439 SkImageEncoder::kPNG_Type, 100); 1439 SkImageEncoder::kPNG_Type, 100);
1440 } 1440 }
1441 } 1441 }
1442 1442
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 SkGraphics::Init(); 2545 SkGraphics::Init();
2546 SkEvent::Init(); 2546 SkEvent::Init();
2547 } 2547 }
2548 2548
2549 // FIXME: this should be in a header 2549 // FIXME: this should be in a header
2550 void application_term(); 2550 void application_term();
2551 void application_term() { 2551 void application_term() {
2552 SkEvent::Term(); 2552 SkEvent::Term();
2553 SkGraphics::Term(); 2553 SkGraphics::Term();
2554 } 2554 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.h ('k') | samplecode/SampleCircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698