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

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

Issue 1321353002: Limit lifetime of GrDrawContext objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 3 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 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 displacement, 446 displacement,
447 offsetMatrix, 447 offsetMatrix,
448 color, 448 color,
449 colorBM.dimensions()))->unref(); 449 colorBM.dimensions()))->unref();
450 SkIRect colorBounds = bounds; 450 SkIRect colorBounds = bounds;
451 colorBounds.offset(-colorOffset); 451 colorBounds.offset(-colorOffset);
452 SkMatrix matrix; 452 SkMatrix matrix;
453 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), 453 matrix.setTranslate(-SkIntToScalar(colorBounds.x()),
454 -SkIntToScalar(colorBounds.y())); 454 -SkIntToScalar(colorBounds.y()));
455 455
456 GrDrawContext* drawContext = context->drawContext(); 456 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext());
457 if (!drawContext) { 457 if (!drawContext) {
458 return false; 458 return false;
459 } 459 }
460 460
461 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matr ix, 461 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matr ix,
462 SkRect::Make(colorBounds)); 462 SkRect::Make(colorBounds));
463 offset->fX = bounds.left(); 463 offset->fX = bounds.left();
464 offset->fY = bounds.top(); 464 offset->fY = bounds.top();
465 WrapTexture(dst, bounds.width(), bounds.height(), result); 465 WrapTexture(dst, bounds.width(), bounds.height(), result);
466 return true; 466 return true;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 633 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
635 635
636 uint32_t xKey = displacementMap.xChannelSelector(); 636 uint32_t xKey = displacementMap.xChannelSelector();
637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
638 638
639 b->add32(xKey | yKey); 639 b->add32(xKey | yKey);
640 } 640 }
641 #endif 641 #endif
642 642
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698