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

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

Issue 562583002: Implement image-rendering:pixelated for accelerated 2D canvases. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 (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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style) 114 RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style)
115 { 115 {
116 LocalFrame* frame = document().frame(); 116 LocalFrame* frame = document().frame();
117 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript)) 117 if (frame && frame->script().canExecuteScripts(NotAboutToExecuteScript))
118 return new RenderHTMLCanvas(this); 118 return new RenderHTMLCanvas(this);
119 return HTMLElement::createRenderer(style); 119 return HTMLElement::createRenderer(style);
120 } 120 }
121 121
122 void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange)
123 {
124 m_imageBuffer->setNearestNeighbor(computedStyle()->imageRendering() == Image RenderingPixelated);
125 }
126
122 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node) 127 Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode * node)
123 { 128 {
124 setIsInCanvasSubtree(true); 129 setIsInCanvasSubtree(true);
125 return HTMLElement::insertedInto(node); 130 return HTMLElement::insertedInto(node);
126 } 131 }
127 132
128 void HTMLCanvasElement::addObserver(CanvasObserver* observer) 133 void HTMLCanvasElement::addObserver(CanvasObserver* observer)
129 { 134 {
130 m_observers.add(observer); 135 m_observers.add(observer);
131 } 136 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 if (!m_context->isAccelerated()) 327 if (!m_context->isAccelerated())
323 return true; 328 return true;
324 329
325 if (renderBox() && renderBox()->hasAcceleratedCompositing()) 330 if (renderBox() && renderBox()->hasAcceleratedCompositing())
326 return false; 331 return false;
327 332
328 return true; 333 return true;
329 } 334 }
330 335
331 336
332 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) 337 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r)
Justin Novosad 2014/09/10 14:28:31 You have to make changes to this function to make
jackhou1 2014/09/11 08:26:31 This should already work, the logic is in RenderHT
333 { 338 {
334 if (m_context) { 339 if (m_context) {
335 if (!paintsIntoCanvasBuffer() && !document().printing()) 340 if (!paintsIntoCanvasBuffer() && !document().printing())
336 return; 341 return;
337 m_context->paintRenderingResultsToCanvas(); 342 m_context->paintRenderingResultsToCanvas();
338 } 343 }
339 344
340 if (hasImageBuffer()) { 345 if (hasImageBuffer()) {
341 ImageBuffer* imageBuffer = buffer(); 346 ImageBuffer* imageBuffer = buffer();
342 if (imageBuffer) { 347 if (imageBuffer) {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 { 745 {
741 return !originClean(); 746 return !originClean();
742 } 747 }
743 748
744 FloatSize HTMLCanvasElement::sourceSize() const 749 FloatSize HTMLCanvasElement::sourceSize() const
745 { 750 {
746 return FloatSize(width(), height()); 751 return FloatSize(width(), height());
747 } 752 }
748 753
749 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698