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

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

Issue 379253002: Initial implementation of display list backed 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied review comments Created 6 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
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 30 matching lines...) Expand all
41 #include "core/html/canvas/CanvasRenderingContext2D.h" 41 #include "core/html/canvas/CanvasRenderingContext2D.h"
42 #include "core/html/canvas/WebGLContextAttributes.h" 42 #include "core/html/canvas/WebGLContextAttributes.h"
43 #include "core/html/canvas/WebGLContextEvent.h" 43 #include "core/html/canvas/WebGLContextEvent.h"
44 #include "core/html/canvas/WebGLRenderingContext.h" 44 #include "core/html/canvas/WebGLRenderingContext.h"
45 #include "core/rendering/RenderHTMLCanvas.h" 45 #include "core/rendering/RenderHTMLCanvas.h"
46 #include "platform/MIMETypeRegistry.h" 46 #include "platform/MIMETypeRegistry.h"
47 #include "platform/RuntimeEnabledFeatures.h" 47 #include "platform/RuntimeEnabledFeatures.h"
48 #include "platform/graphics/Canvas2DImageBufferSurface.h" 48 #include "platform/graphics/Canvas2DImageBufferSurface.h"
49 #include "platform/graphics/GraphicsContextStateSaver.h" 49 #include "platform/graphics/GraphicsContextStateSaver.h"
50 #include "platform/graphics/ImageBuffer.h" 50 #include "platform/graphics/ImageBuffer.h"
51 #include "platform/graphics/RecordingImageBufferSurface.h"
51 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 52 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
52 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" 53 #include "platform/graphics/gpu/WebGLImageBufferSurface.h"
53 #include "platform/transforms/AffineTransform.h" 54 #include "platform/transforms/AffineTransform.h"
54 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
55 #include <math.h> 56 #include <math.h>
56 #include <v8.h> 57 #include <v8.h>
57 58
58 namespace WebCore { 59 namespace WebCore {
59 60
60 using namespace HTMLNames; 61 using namespace HTMLNames;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 446 }
446 447
447 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) 448 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount)
448 { 449 {
449 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; 450 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque;
450 451
451 *msaaSampleCount = 0; 452 *msaaSampleCount = 0;
452 if (is3D()) 453 if (is3D())
453 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); 454 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode));
454 455
456 if (document().settings() && document().settings()->displayList2dCanvasEnabl ed()) {
457 OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSu rface(size(), opacityMode));
458 if (surface->isValid())
459 return surface.release();
460 }
461
455 if (shouldAccelerate(deviceSize)) { 462 if (shouldAccelerate(deviceSize)) {
456 if (document().settings()) 463 if (document().settings())
457 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount(); 464 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount();
458 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount)); 465 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount));
459 if (surface->isValid()) 466 if (surface->isValid())
460 return surface.release(); 467 return surface.release();
461 } 468 }
462 469
463 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); 470 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode));
464 } 471 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 { 707 {
701 return !originClean(); 708 return !originClean();
702 } 709 }
703 710
704 FloatSize HTMLCanvasElement::sourceSize() const 711 FloatSize HTMLCanvasElement::sourceSize() const
705 { 712 {
706 return FloatSize(width(), height()); 713 return FloatSize(width(), height());
707 } 714 }
708 715
709 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698