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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « include/core/SkBitmap.h ('k') | samplecode/SampleDither.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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 // to redraw. 1442 // to redraw.
1443 this->inval(NULL); 1443 this->inval(NULL);
1444 return; 1444 return;
1445 } 1445 }
1446 1446
1447 if (fRequestGrabImage) { 1447 if (fRequestGrabImage) {
1448 fRequestGrabImage = false; 1448 fRequestGrabImage = false;
1449 1449
1450 SkBaseDevice* device = orig->getDevice(); 1450 SkBaseDevice* device = orig->getDevice();
1451 SkBitmap bmp; 1451 SkBitmap bmp;
1452 if (device->accessBitmap(false).copyTo(&bmp, SkBitmap::kARGB_8888_Config )) { 1452 if (device->accessBitmap(false).copyTo(&bmp, kPMColor_SkColorType)) {
1453 static int gSampleGrabCounter; 1453 static int gSampleGrabCounter;
1454 SkString name; 1454 SkString name;
1455 name.printf("sample_grab_%d.png", gSampleGrabCounter++); 1455 name.printf("sample_grab_%d.png", gSampleGrabCounter++);
1456 SkImageEncoder::EncodeFile(name.c_str(), bmp, 1456 SkImageEncoder::EncodeFile(name.c_str(), bmp,
1457 SkImageEncoder::kPNG_Type, 100); 1457 SkImageEncoder::kPNG_Type, 100);
1458 } 1458 }
1459 } 1459 }
1460 1460
1461 if (kPicture_DeviceType == fDeviceType) { 1461 if (kPicture_DeviceType == fDeviceType) {
1462 if (true) { 1462 if (true) {
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 SkGraphics::Init(); 2562 SkGraphics::Init();
2563 SkEvent::Init(); 2563 SkEvent::Init();
2564 } 2564 }
2565 2565
2566 // FIXME: this should be in a header 2566 // FIXME: this should be in a header
2567 void application_term(); 2567 void application_term();
2568 void application_term() { 2568 void application_term() {
2569 SkEvent::Term(); 2569 SkEvent::Term();
2570 SkGraphics::Term(); 2570 SkGraphics::Term();
2571 } 2571 }
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | samplecode/SampleDither.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698