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

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 900463002: Make SVG painting independent of GraphicsContext's alpha state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 #if ENABLE(ASSERT) 233 #if ENABLE(ASSERT)
234 void GraphicsContext::setInDrawingRecorder(bool val) 234 void GraphicsContext::setInDrawingRecorder(bool val)
235 { 235 {
236 // Nested drawing recorers are not allowed. 236 // Nested drawing recorers are not allowed.
237 ASSERT(!val || !m_inDrawingRecorder); 237 ASSERT(!val || !m_inDrawingRecorder);
238 m_inDrawingRecorder = val; 238 m_inDrawingRecorder = val;
239 } 239 }
240 #endif 240 #endif
241 241
242 void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern) 242 void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern, float additi onalAlpha)
243 { 243 {
244 if (contextDisabled()) 244 if (contextDisabled())
245 return; 245 return;
246 246
247 ASSERT(pattern); 247 ASSERT(pattern);
248 if (!pattern) { 248 if (!pattern) {
249 setStrokeColor(Color::black); 249 setStrokeColor(Color::black);
250 return; 250 return;
251 } 251 }
252 252
253 mutableState()->setStrokePattern(pattern); 253 mutableState()->setStrokePattern(pattern, additionalAlpha);
254 } 254 }
255 255
256 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient) 256 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient, float add itionalAlpha)
257 { 257 {
258 if (contextDisabled()) 258 if (contextDisabled())
259 return; 259 return;
260 260
261 ASSERT(gradient); 261 ASSERT(gradient);
262 if (!gradient) { 262 if (!gradient) {
263 setStrokeColor(Color::black); 263 setStrokeColor(Color::black);
264 return; 264 return;
265 } 265 }
266 mutableState()->setStrokeGradient(gradient); 266 mutableState()->setStrokeGradient(gradient, additionalAlpha);
267 } 267 }
268 268
269 void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern) 269 void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern, float addition alAlpha)
270 { 270 {
271 if (contextDisabled()) 271 if (contextDisabled())
272 return; 272 return;
273 273
274 ASSERT(pattern); 274 ASSERT(pattern);
275 if (!pattern) { 275 if (!pattern) {
276 setFillColor(Color::black); 276 setFillColor(Color::black);
277 return; 277 return;
278 } 278 }
279 279
280 mutableState()->setFillPattern(pattern); 280 mutableState()->setFillPattern(pattern, additionalAlpha);
281 } 281 }
282 282
283 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient) 283 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient, float addit ionalAlpha)
chrishtr 2015/02/03 00:34:16 Why "additional" alpha?
pdr. 2015/02/04 04:04:31 I thought it might disambiguate that the alpha can
284 { 284 {
285 if (contextDisabled()) 285 if (contextDisabled())
286 return; 286 return;
287 287
288 ASSERT(gradient); 288 ASSERT(gradient);
289 if (!gradient) { 289 if (!gradient) {
290 setFillColor(Color::black); 290 setFillColor(Color::black);
291 return; 291 return;
292 } 292 }
293 293
294 mutableState()->setFillGradient(gradient); 294 mutableState()->setFillGradient(gradient, additionalAlpha);
295 } 295 }
296 296
297 void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color & color, 297 void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color & color,
298 DrawLooperBuilder::ShadowTransformMode shadowTransformMode, 298 DrawLooperBuilder::ShadowTransformMode shadowTransformMode,
299 DrawLooperBuilder::ShadowAlphaMode shadowAlphaMode, ShadowMode shadowMode) 299 DrawLooperBuilder::ShadowAlphaMode shadowAlphaMode, ShadowMode shadowMode)
300 { 300 {
301 if (contextDisabled()) 301 if (contextDisabled())
302 return; 302 return;
303 303
304 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); 304 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create();
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 return initialSaveCount; 1941 return initialSaveCount;
1942 } 1942 }
1943 1943
1944 void GraphicsContext::setClient(GraphicsContextClient* client) 1944 void GraphicsContext::setClient(GraphicsContextClient* client)
1945 { 1945 {
1946 ASSERT(client == 0 || m_client == 0); // No clobbering 1946 ASSERT(client == 0 || m_client == 0); // No clobbering
1947 m_client = client; 1947 m_client = client;
1948 } 1948 }
1949 1949
1950 } // namespace blink 1950 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698