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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 1115553002: Removing blink::prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « Source/core/html/HTMLAnchorElement.cpp ('k') | Source/core/html/HTMLDetailsElement.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 (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 ContextTypeCount, 214 ContextTypeCount,
215 }; 215 };
216 216
217 // FIXME - The code depends on the context not going away once created, to p revent JS from 217 // FIXME - The code depends on the context not going away once created, to p revent JS from
218 // seeing a dangling pointer. So for now we will disallow the context from b eing changed 218 // seeing a dangling pointer. So for now we will disallow the context from b eing changed
219 // once it is created. 219 // once it is created.
220 if (type == "2d") { 220 if (type == "2d") {
221 if (m_context && !m_context->is2d()) 221 if (m_context && !m_context->is2d())
222 return; 222 return;
223 if (!m_context) { 223 if (!m_context) {
224 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", Context2d, ContextTypeCount); 224 Platform::current()->histogramEnumeration("Canvas.ContextType", Cont ext2d, ContextTypeCount);
225 225
226 m_context = CanvasRenderingContext2D::create(this, attributes, docum ent()); 226 m_context = CanvasRenderingContext2D::create(this, attributes, docum ent());
227 setNeedsCompositingUpdate(); 227 setNeedsCompositingUpdate();
228 } 228 }
229 result.setCanvasRenderingContext2D(static_cast<CanvasRenderingContext2D* >(m_context.get())); 229 result.setCanvasRenderingContext2D(static_cast<CanvasRenderingContext2D* >(m_context.get()));
230 return; 230 return;
231 } 231 }
232 232
233 // Accept the the provisional "experimental-webgl" or official "webgl" conte xt ID. 233 // Accept the the provisional "experimental-webgl" or official "webgl" conte xt ID.
234 ContextType contextType = Context2d; 234 ContextType contextType = Context2d;
235 bool is3dContext = true; 235 bool is3dContext = true;
236 if (type == "experimental-webgl") 236 if (type == "experimental-webgl")
237 contextType = ContextExperimentalWebgl; 237 contextType = ContextExperimentalWebgl;
238 else if (type == "webgl") 238 else if (type == "webgl")
239 contextType = ContextWebgl; 239 contextType = ContextWebgl;
240 else if (type == "webgl2") 240 else if (type == "webgl2")
241 contextType = ContextWebgl2; 241 contextType = ContextWebgl2;
242 else 242 else
243 is3dContext = false; 243 is3dContext = false;
244 244
245 if (is3dContext) { 245 if (is3dContext) {
246 if (!m_context) { 246 if (!m_context) {
247 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", contextType, ContextTypeCount); 247 Platform::current()->histogramEnumeration("Canvas.ContextType", cont extType, ContextTypeCount);
248 if (contextType == ContextWebgl2) { 248 if (contextType == ContextWebgl2) {
249 m_context = WebGL2RenderingContext::create(this, attributes); 249 m_context = WebGL2RenderingContext::create(this, attributes);
250 } else { 250 } else {
251 m_context = WebGLRenderingContext::create(this, attributes); 251 m_context = WebGLRenderingContext::create(this, attributes);
252 } 252 }
253 const ComputedStyle* style = ensureComputedStyle(); 253 const ComputedStyle* style = ensureComputedStyle();
254 if (style && m_context) 254 if (style && m_context)
255 toWebGLRenderingContextBase(m_context.get())->setFilterQuality(s tyle->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow _SkFilterQuality); 255 toWebGLRenderingContextBase(m_context.get())->setFilterQuality(s tyle->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow _SkFilterQuality);
256 setNeedsCompositingUpdate(); 256 setNeedsCompositingUpdate();
257 updateExternallyAllocatedMemory(); 257 updateExternallyAllocatedMemory();
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return false; 546 return false;
547 547
548 Settings* settings = document().settings(); 548 Settings* settings = document().settings();
549 if (!settings || !settings->accelerated2dCanvasEnabled()) 549 if (!settings || !settings->accelerated2dCanvasEnabled())
550 return false; 550 return false;
551 551
552 // Do not use acceleration for small canvas. 552 // Do not use acceleration for small canvas.
553 if (size.width() * size.height() < settings->minimumAccelerated2dCanvasSize( )) 553 if (size.width() * size.height() < settings->minimumAccelerated2dCanvasSize( ))
554 return false; 554 return false;
555 555
556 if (!blink::Platform::current()->canAccelerate2dCanvas()) 556 if (!Platform::current()->canAccelerate2dCanvas())
557 return false; 557 return false;
558 558
559 return true; 559 return true;
560 } 560 }
561 561
562 class UnacceleratedSurfaceFactory : public RecordingImageBufferFallbackSurfaceFa ctory { 562 class UnacceleratedSurfaceFactory : public RecordingImageBufferFallbackSurfaceFa ctory {
563 public: 563 public:
564 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, Op acityMode opacityMode) 564 virtual PassOwnPtr<ImageBufferSurface> createSurface(const IntSize& size, Op acityMode opacityMode)
565 { 565 {
566 return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode)); 566 return adoptPtr(new UnacceleratedImageBufferSurface(size, opacityMode));
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 { 877 {
878 return FloatSize(width(), height()); 878 return FloatSize(width(), height());
879 } 879 }
880 880
881 bool HTMLCanvasElement::isOpaque() const 881 bool HTMLCanvasElement::isOpaque() const
882 { 882 {
883 return m_context && !m_context->hasAlpha(); 883 return m_context && !m_context->hasAlpha();
884 } 884 }
885 885
886 } // blink 886 } // blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLAnchorElement.cpp ('k') | Source/core/html/HTMLDetailsElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698