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

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

Issue 2164363002: Add SkColorSpace to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ':' from comment Created 4 years, 5 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 | « samplecode/SampleApp.cpp ('k') | src/core/SkSpecialImage.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 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context, 276 sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
277 sk_sp<GrFragmentProcessor> fp, 277 sk_sp<GrFragmentProcessor> fp,
278 const SkIRect& bounds, 278 const SkIRect& bounds,
279 sk_sp<SkColorSpace> colorSpace) { 279 sk_sp<SkColorSpace> colorSpace) {
280 GrPaint paint; 280 GrPaint paint;
281 paint.addColorFragmentProcessor(std::move(fp)); 281 paint.addColorFragmentProcessor(std::move(fp));
282 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 282 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
283 283
284 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox, 284 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox,
285 bounds.width(), bou nds.height(), 285 bounds.width(), bou nds.height(),
286 kRGBA_8888_GrPixelC onfig)); 286 kRGBA_8888_GrPixelC onfig,
287 std::move(colorSpac e)));
287 if (!drawContext) { 288 if (!drawContext) {
288 return nullptr; 289 return nullptr;
289 } 290 }
290 291
291 SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height()); 292 SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height());
292 SkRect srcRect = SkRect::Make(bounds); 293 SkRect srcRect = SkRect::Make(bounds);
293 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); 294 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
294 GrFixedClip clip(dstIRect); 295 GrFixedClip clip(dstIRect);
295 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); 296 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
296 297
297 // TODO: Get the colorSpace from the drawContext (once it has one)
298 return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialIm age, 298 return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialIm age,
299 drawContext->asTexture(), std::move(color Space)); 299 drawContext->asTexture(),
300 sk_ref_sp(drawContext->getColorSpace()));
300 } 301 }
301 #endif 302 #endif
302 303
303 bool SkImageFilter::asAColorFilter(SkColorFilter** filterPtr) const { 304 bool SkImageFilter::asAColorFilter(SkColorFilter** filterPtr) const {
304 SkASSERT(nullptr != filterPtr); 305 SkASSERT(nullptr != filterPtr);
305 if (!this->isColorFilterNode(filterPtr)) { 306 if (!this->isColorFilterNode(filterPtr)) {
306 return false; 307 return false;
307 } 308 }
308 if (nullptr != this->getInput(0) || (*filterPtr)->affectsTransparentBlack()) { 309 if (nullptr != this->getInput(0) || (*filterPtr)->affectsTransparentBlack()) {
309 (*filterPtr)->unref(); 310 (*filterPtr)->unref();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx), offset)); 442 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx), offset));
442 443
443 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked()); 444 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked());
444 445
445 return result; 446 return result;
446 } 447 }
447 448
448 void SkImageFilter::PurgeCache() { 449 void SkImageFilter::PurgeCache() {
449 SkImageFilterCache::Get()->purge(); 450 SkImageFilterCache::Get()->purge();
450 } 451 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698