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

Side by Side Diff: src/gpu/GrSurface.cpp

Issue 27044002: Clean up SkTypes.h. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: For patch -p1. Created 7 years, 2 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/SamplePath.cpp ('k') | src/gpu/gl/GrGLUtil.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 2012 Google Inc. 2 * Copyright 2012 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 7
8 #include "GrSurface.h" 8 #include "GrSurface.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkImageEncoder.h" 11 #include "SkImageEncoder.h"
12 #include <stdio.h>
12 13
13 SK_DEFINE_INST_COUNT(GrSurface) 14 SK_DEFINE_INST_COUNT(GrSurface)
14 15
15 bool GrSurface::savePixels(const char* filename) { 16 bool GrSurface::savePixels(const char* filename) {
16 SkBitmap bm; 17 SkBitmap bm;
17 bm.setConfig(SkBitmap::kARGB_8888_Config, this->width(), this->height()); 18 bm.setConfig(SkBitmap::kARGB_8888_Config, this->width(), this->height());
18 bm.allocPixels(); 19 bm.allocPixels();
19 20
20 bool result = readPixels(0, 0, this->width(), this->height(), kSkia8888_GrPi xelConfig, 21 bool result = readPixels(0, 0, this->width(), this->height(), kSkia8888_GrPi xelConfig,
21 bm.getPixels()); 22 bm.getPixels());
22 if (!result) { 23 if (!result) {
23 SkDebugf("------ failed to read pixels for %s\n", filename); 24 SkDebugf("------ failed to read pixels for %s\n", filename);
24 return false; 25 return false;
25 } 26 }
26 27
27 // remove any previous version of this file 28 // remove any previous version of this file
28 remove(filename); 29 remove(filename);
29 30
30 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) { 31 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) {
31 SkDebugf("------ failed to encode %s\n", filename); 32 SkDebugf("------ failed to encode %s\n", filename);
32 remove(filename); // remove any partial file 33 remove(filename); // remove any partial file
33 return false; 34 return false;
34 } 35 }
35 36
36 return true; 37 return true;
37 } 38 }
OLDNEW
« no previous file with comments | « samplecode/SamplePath.cpp ('k') | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698