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

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

Issue 18622004: use SkIntToScalar (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 "SkBlendImageFilter.h" 8 #include "SkBlendImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 SkAutoLockPixels alp_foreground(foreground), alp_background(background); 80 SkAutoLockPixels alp_foreground(foreground), alp_background(background);
81 if (!foreground.getPixels() || !background.getPixels()) { 81 if (!foreground.getPixels() || !background.getPixels()) {
82 return false; 82 return false;
83 } 83 }
84 dst->setConfig(background.config(), background.width(), background.height()) ; 84 dst->setConfig(background.config(), background.width(), background.height()) ;
85 dst->allocPixels(); 85 dst->allocPixels();
86 SkCanvas canvas(*dst); 86 SkCanvas canvas(*dst);
87 SkPaint paint; 87 SkPaint paint;
88 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 88 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
89 canvas.drawBitmap(background, backgroundOffset.fX, backgroundOffset.fY, &pai nt); 89 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX),
90 SkIntToScalar(backgroundOffset.fY), &paint);
90 paint.setXfermodeMode(modeToXfermode(fMode)); 91 paint.setXfermodeMode(modeToXfermode(fMode));
91 canvas.drawBitmap(foreground, foregroundOffset.fX, foregroundOffset.fY, &pai nt); 92 canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX),
93 SkIntToScalar(foregroundOffset.fY), &paint);
92 return true; 94 return true;
93 } 95 }
94 96
95 /////////////////////////////////////////////////////////////////////////////// 97 ///////////////////////////////////////////////////////////////////////////////
96 98
97 #if SK_SUPPORT_GPU 99 #if SK_SUPPORT_GPU
98 class GrGLBlendEffect : public GrGLEffect { 100 class GrGLBlendEffect : public GrGLEffect {
99 public: 101 public:
100 GrGLBlendEffect(const GrBackendEffectFactory&, const GrDrawEffect&); 102 GrGLBlendEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
101 virtual ~GrGLBlendEffect(); 103 virtual ~GrGLBlendEffect();
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri x(bgTex), 339 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri x(bgTex),
338 drawEffect, 340 drawEffect,
339 kCoordsType, 341 kCoordsType,
340 bgTex); 342 bgTex);
341 bgKey <<= GrGLEffectMatrix::kKeyBits; 343 bgKey <<= GrGLEffectMatrix::kKeyBits;
342 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); 344 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits);
343 345
344 return modeKey | bgKey | fgKey; 346 return modeKey | bgKey | fgKey;
345 } 347 }
346 #endif 348 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698