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

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

Issue 2250403003: Add alpha type to texture producer (Closed) Base URL: https://skia.googlesource.com/skia.git@image-alpha-type
Patch Set: Created 4 years, 4 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/GrTextureParamsAdjuster.h ('k') | src/gpu/SkGpuDevice.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 2015 Google Inc. 2 * Copyright 2015 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 "GrTextureParamsAdjuster.h" 8 #include "GrTextureParamsAdjuster.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 localRect.fBottom *= sy; 105 localRect.fBottom *= sy;
106 } else { 106 } else {
107 localRect = SkRect::MakeWH(1.f, 1.f); 107 localRect = SkRect::MakeWH(1.f, 1.f);
108 } 108 }
109 109
110 SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight); 110 SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
111 copyDC->fillRectToRect(GrNoClip(), paint, SkMatrix::I(), dstRect, localRect) ; 111 copyDC->fillRectToRect(GrNoClip(), paint, SkMatrix::I(), dstRect, localRect) ;
112 return copyDC->asTexture().release(); 112 return copyDC->asTexture().release();
113 } 113 }
114 114
115 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, const SkIRect& content Area, 115 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, SkAlphaType alphaType,
116 uint32_t uniqueID, SkColorSpace* cs) 116 const SkIRect& contentArea, uint32_t unique ID,
117 SkColorSpace* cs)
117 : INHERITED(contentArea.width(), contentArea.height(), 118 : INHERITED(contentArea.width(), contentArea.height(),
118 GrPixelConfigIsAlphaOnly(original->config())) 119 GrPixelConfigIsAlphaOnly(original->config()))
119 , fOriginal(original) 120 , fOriginal(original)
121 , fAlphaType(alphaType)
120 , fColorSpace(cs) 122 , fColorSpace(cs)
121 , fUniqueID(uniqueID) 123 , fUniqueID(uniqueID)
122 { 124 {
123 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con tentArea)); 125 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con tentArea));
124 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || 126 if (contentArea.fLeft > 0 || contentArea.fTop > 0 ||
125 contentArea.fRight < original->width() || contentArea.fBottom < original ->height()) { 127 contentArea.fRight < original->width() || contentArea.fBottom < original ->height()) {
126 fContentArea.set(contentArea); 128 fContentArea.set(contentArea);
127 } 129 }
128 } 130 }
129 131
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 535 }
534 536
535 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped, 537 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped,
536 SkSourceGammaTreatment gamma Treatment) { 538 SkSourceGammaTreatment gamma Treatment) {
537 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment)); 539 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment));
538 if (!original) { 540 if (!original) {
539 return nullptr; 541 return nullptr;
540 } 542 }
541 return copy_on_gpu(original, nullptr, copyParams); 543 return copy_on_gpu(original, nullptr, copyParams);
542 } 544 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698