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

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

Issue 1205643002: Make SkGpuDevice know its alpha type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix bench pictures :( Created 5 years, 6 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
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | src/gpu/GrSurfacePriv.h » ('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 #include "GrSurfacePriv.h" 9 #include "GrSurfacePriv.h"
10 10
(...skipping 23 matching lines...) Expand all
34 return false; 34 return false;
35 } 35 }
36 GrRenderTarget* target = this->asRenderTarget(); 36 GrRenderTarget* target = this->asRenderTarget();
37 if (target) { 37 if (target) {
38 return context->readRenderTargetPixels(target, left, top, width, height, config, buffer, 38 return context->readRenderTargetPixels(target, left, top, width, height, config, buffer,
39 rowBytes, pixelOpsFlags); 39 rowBytes, pixelOpsFlags);
40 } 40 }
41 return false; 41 return false;
42 } 42 }
43 43
44 SkImageInfo GrSurface::info() const { 44 SkImageInfo GrSurface::info(SkAlphaType alphaType) const {
45 SkColorType colorType; 45 SkColorType colorType;
46 SkColorProfileType profileType; 46 SkColorProfileType profileType;
47 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT ype)) { 47 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT ype)) {
48 sk_throw(); 48 sk_throw();
49 } 49 }
50 return SkImageInfo::Make(this->width(), this->height(), colorType, kPremul_S kAlphaType, 50 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType ,
51 profileType); 51 profileType);
52 } 52 }
53 53
54 // TODO: This should probably be a non-member helper function. It might only be needed in 54 // TODO: This should probably be a non-member helper function. It might only be needed in
55 // debug or developer builds. 55 // debug or developer builds.
56 bool GrSurface::savePixels(const char* filename) { 56 bool GrSurface::savePixels(const char* filename) {
57 SkBitmap bm; 57 SkBitmap bm;
58 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh t()))) { 58 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh t()))) {
59 return false; 59 return false;
60 } 60 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 void GrSurface::onRelease() { 129 void GrSurface::onRelease() {
130 this->invokeReleaseProc(); 130 this->invokeReleaseProc();
131 this->INHERITED::onRelease(); 131 this->INHERITED::onRelease();
132 } 132 }
133 133
134 void GrSurface::onAbandon() { 134 void GrSurface::onAbandon() {
135 this->invokeReleaseProc(); 135 this->invokeReleaseProc();
136 this->INHERITED::onAbandon(); 136 this->INHERITED::onAbandon();
137 } 137 }
OLDNEW
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | src/gpu/GrSurfacePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698