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

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

Issue 1013803002: SkPaint::FilterLevel -> SkFilterQuality (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: I think I caught the last one Created 5 years, 9 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 | « no previous file | Source/core/html/canvas/WebGLRenderingContextBase.h » ('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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 LayoutObject* HTMLCanvasElement::createLayoutObject(const LayoutStyle& style) 141 LayoutObject* HTMLCanvasElement::createLayoutObject(const LayoutStyle& style)
142 { 142 {
143 LocalFrame* frame = document().frame(); 143 LocalFrame* frame = document().frame();
144 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) 144 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
145 return new LayoutHTMLCanvas(this); 145 return new LayoutHTMLCanvas(this);
146 return HTMLElement::createLayoutObject(style); 146 return HTMLElement::createLayoutObject(style);
147 } 147 }
148 148
149 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) 149 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange)
150 { 150 {
151 SkPaint::FilterLevel filterLevel = computedStyle()->imageRendering() == Imag eRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel; 151 SkFilterQuality filterQuality = computedStyle()->imageRendering() == ImageRe nderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality;
152 if (is3D()) { 152 if (is3D()) {
153 toWebGLRenderingContextBase(m_context.get())->setFilterLevel(filterLevel ); 153 toWebGLRenderingContextBase(m_context.get())->setFilterQuality(filterQua lity);
154 setNeedsCompositingUpdate(); 154 setNeedsCompositingUpdate();
155 } else if (hasImageBuffer()) { 155 } else if (hasImageBuffer()) {
156 m_imageBuffer->setFilterLevel(filterLevel); 156 m_imageBuffer->setFilterQuality(filterQuality);
157 } 157 }
158 } 158 }
159 159
160 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node) 160 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node)
161 { 161 {
162 setIsInCanvasSubtree(true); 162 setIsInCanvasSubtree(true);
163 return HTMLElement::insertedInto(node); 163 return HTMLElement::insertedInto(node);
164 } 164 }
165 165
166 void HTMLCanvasElement::addObserver(CanvasObserver* observer) 166 void HTMLCanvasElement::addObserver(CanvasObserver* observer)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (is3dContext) { 245 if (is3dContext) {
246 if (!m_context) { 246 if (!m_context) {
247 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", contextType, ContextTypeCount); 247 blink::Platform::current()->histogramEnumeration("Canvas.ContextType ", contextType, 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 LayoutStyle* style = computedStyle(); 253 LayoutStyle* style = computedStyle();
254 if (style && m_context) 254 if (style && m_context)
255 toWebGLRenderingContextBase(m_context.get())->setFilterLevel(sty le->imageRendering() == ImageRenderingPixelated ? SkPaint::kNone_FilterLevel : S kPaint::kLow_FilterLevel); 255 toWebGLRenderingContextBase(m_context.get())->setFilterQuality(s tyle->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow _SkFilterQuality);
256 setNeedsCompositingUpdate(); 256 setNeedsCompositingUpdate();
257 updateExternallyAllocatedMemory(); 257 updateExternallyAllocatedMemory();
258 } else if (!m_context->is3d()) { 258 } else if (!m_context->is3d()) {
259 dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext creationerror, false, true, "Canvas has an existing, non-WebGL context")); 259 dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext creationerror, false, true, "Canvas has an existing, non-WebGL context"));
260 return; 260 return;
261 } 261 }
262 result.setWebGLRenderingContext(static_cast<WebGLRenderingContext*>(m_co ntext.get())); 262 result.setWebGLRenderingContext(static_cast<WebGLRenderingContext*>(m_co ntext.get()));
263 } 263 }
264 264
265 return; 265 return;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } else { 655 } else {
656 surface = createImageBufferSurface(size(), &msaaSampleCount); 656 surface = createImageBufferSurface(size(), &msaaSampleCount);
657 } 657 }
658 m_imageBuffer = ImageBuffer::create(surface.release()); 658 m_imageBuffer = ImageBuffer::create(surface.release());
659 if (!m_imageBuffer) 659 if (!m_imageBuffer)
660 return; 660 return;
661 m_imageBuffer->setClient(this); 661 m_imageBuffer->setClient(this);
662 662
663 document().updateRenderTreeIfNeeded(); 663 document().updateRenderTreeIfNeeded();
664 LayoutStyle* style = computedStyle(); 664 LayoutStyle* style = computedStyle();
665 m_imageBuffer->setFilterLevel((style && (style->imageRendering() == ImageRen deringPixelated)) ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel); 665 m_imageBuffer->setFilterQuality((style && (style->imageRendering() == ImageR enderingPixelated)) ? kNone_SkFilterQuality : kLow_SkFilterQuality);
666 666
667 m_didFailToCreateImageBuffer = false; 667 m_didFailToCreateImageBuffer = false;
668 668
669 updateExternallyAllocatedMemory(); 669 updateExternallyAllocatedMemory();
670 670
671 if (is3D()) { 671 if (is3D()) {
672 // Early out for WebGL canvases 672 // Early out for WebGL canvases
673 return; 673 return;
674 } 674 }
675 675
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 { 892 {
893 return FloatSize(width(), height()); 893 return FloatSize(width(), height());
894 } 894 }
895 895
896 bool HTMLCanvasElement::isOpaque() const 896 bool HTMLCanvasElement::isOpaque() const
897 { 897 {
898 return m_context && !m_context->hasAlpha(); 898 return m_context && !m_context->hasAlpha();
899 } 899 }
900 900
901 } // blink 901 } // blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698