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

Side by Side Diff: src/core/SkSpecialImage.cpp

Issue 1814533003: Revert of sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/core/SkImageCacherator.cpp ('k') | src/effects/SkTableColorFilter.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 2016 Google Inc. 2 * Copyright 2016 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkImage_Base.h" 9 #include "SkImage_Base.h"
10 #include "SkSpecialImage.h" 10 #include "SkSpecialImage.h"
11 #include "SkSpecialSurface.h" 11 #include "SkSpecialSurface.h"
12 12
13 #include "GrContext.h"
14
15 /////////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////////
16 class SkSpecialImage_Base : public SkSpecialImage { 14 class SkSpecialImage_Base : public SkSpecialImage {
17 public: 15 public:
18 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID) 16 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID)
19 : INHERITED(proxy, subset, uniqueID) { 17 : INHERITED(proxy, subset, uniqueID) {
20 } 18 }
21 virtual ~SkSpecialImage_Base() { } 19 virtual ~SkSpecialImage_Base() { }
22 20
23 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0; 21 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0;
24 22
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 159 }
162 160
163 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { 161 bool testingOnlyOnGetROPixels(SkBitmap* result) const override {
164 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode); 162 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode);
165 } 163 }
166 164
167 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { 165 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override {
168 #if SK_SUPPORT_GPU 166 #if SK_SUPPORT_GPU
169 GrTexture* texture = as_IB(fImage.get())->peekTexture(); 167 GrTexture* texture = as_IB(fImage.get())->peekTexture();
170 if (texture) { 168 if (texture) {
171 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getCon text()->caps()); 169 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info);
172 desc.fFlags = kRenderTarget_GrSurfaceFlag; 170 desc.fFlags = kRenderTarget_GrSurfaceFlag;
173 171
174 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get Context(), desc); 172 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get Context(), desc);
175 } 173 }
176 #endif 174 #endif
177 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); 175 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr);
178 } 176 }
179 177
180 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { 178 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override {
181 SkAutoTUnref<SkImage> subsetImg(fImage->newSubset(subset)); 179 SkAutoTUnref<SkImage> subsetImg(fImage->newSubset(subset));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia 8888_GrPixelConfig, 377 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia 8888_GrPixelConfig,
380 result->getPixels(), result->rowBytes())) { 378 result->getPixels(), result->rowBytes())) {
381 return false; 379 return false;
382 } 380 }
383 381
384 result->pixelRef()->setImmutable(); 382 result->pixelRef()->setImmutable();
385 return true; 383 return true;
386 } 384 }
387 385
388 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { 386 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override {
389 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex t()->caps()); 387 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info);
390 desc.fFlags = kRenderTarget_GrSurfaceFlag; 388 desc.fFlags = kRenderTarget_GrSurfaceFlag;
391 389
392 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon text(), desc); 390 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon text(), desc);
393 } 391 }
394 392
395 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { 393 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override {
396 return SkSpecialImage::NewFromGpu(this->internal_getProxy(), 394 return SkSpecialImage::NewFromGpu(this->internal_getProxy(),
397 subset, 395 subset,
398 this->uniqueID(), 396 this->uniqueID(),
399 fTexture, 397 fTexture,
(...skipping 20 matching lines...) Expand all
420 418
421 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, 419 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy,
422 const SkIRect& subset, 420 const SkIRect& subset,
423 uint32_t uniqueID, 421 uint32_t uniqueID,
424 GrTexture* tex, 422 GrTexture* tex,
425 SkAlphaType at) { 423 SkAlphaType at) {
426 return nullptr; 424 return nullptr;
427 } 425 }
428 426
429 #endif 427 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/effects/SkTableColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698