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

Side by Side Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 scale, 339 scale,
340 displTexture.get(), 340 displTexture.get(),
341 offsetMatrix, 341 offsetMatrix,
342 colorTexture.get(), 342 colorTexture.get(),
343 SkISize::Make(color->width(), 343 SkISize::Make(color->width(),
344 color->height())))->un ref(); 344 color->height())))->un ref();
345 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 345 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
346 SkMatrix matrix; 346 SkMatrix matrix;
347 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo rBounds.y())); 347 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo rBounds.y()));
348 348
349 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRend erTarget())); 349 sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asR enderTarget())));
350 if (!drawContext) { 350 if (!drawContext) {
351 return nullptr; 351 return nullptr;
352 } 352 }
353 353
354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co lorBounds)); 354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co lorBounds));
355 355
356 offset->fX = bounds.left(); 356 offset->fX = bounds.left();
357 offset->fY = bounds.top(); 357 offset->fY = bounds.top();
358 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound s.height()), 358 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound s.height()),
359 kNeedNewImageUniqueID_SpecialImage, 359 kNeedNewImageUniqueID_SpecialImage,
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
627 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 627 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
629 629
630 uint32_t xKey = displacementMap.xChannelSelector(); 630 uint32_t xKey = displacementMap.xChannelSelector();
631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
632 632
633 b->add32(xKey | yKey); 633 b->add32(xKey | yKey);
634 } 634 }
635 #endif 635 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698