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

Unified Diff: src/gpu/GrSurface.cpp

Issue 665913002: Move code to dump GrSurface as a png to helper files (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-encoder-01-skimage
Patch Set: address review comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | src/gpu/GrSurfacePriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSurface.cpp
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 0aa5f681ab2d1a07657e9814b77ff20b039d9766..c2163770912216c5170a209c00e02e1436d6012f 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -10,8 +10,6 @@
#include "SkBitmap.h"
#include "SkGr.h"
-#include "SkImageEncoder.h"
-#include <stdio.h>
bool GrSurface::writePixels(int left, int top, int width, int height,
GrPixelConfig config, const void* buffer, size_t rowBytes,
@@ -49,32 +47,6 @@ SkImageInfo GrSurface::info() const {
return SkImageInfo::Make(this->width(), this->height(), colorType, kPremul_SkAlphaType);
}
-// TODO: This should probably be a non-member helper function. It might only be needed in
-// debug or developer builds.
-bool GrSurface::savePixels(const char* filename) {
- SkBitmap bm;
- if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->height()))) {
- return false;
- }
-
- bool result = this->readPixels(0, 0, this->width(), this->height(), kSkia8888_GrPixelConfig,
- bm.getPixels());
- if (!result) {
- SkDebugf("------ failed to read pixels for %s\n", filename);
- return false;
- }
-
- // remove any previous version of this file
- remove(filename);
-
- if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100)) {
- SkDebugf("------ failed to encode %s\n", filename);
- remove(filename); // remove any partial file
- return false;
- }
-
- return true;
-}
void GrSurface::flushWrites() {
if (!this->wasDestroyed()) {
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | src/gpu/GrSurfacePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698