Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / web / WebGraphicsContextImpl.cpp
blobd40c99f06b8421895790a8a007fa673119036a0a
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "web/WebGraphicsContextImpl.h"
8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/DrawingRecorder.h"
11 namespace blink {
13 WebGraphicsContextImpl::WebGraphicsContextImpl(GraphicsContext& graphicsContext, const DisplayItemClientWrapper& client, DisplayItem::Type type)
14 : m_graphicsContext(graphicsContext)
15 , m_client(client)
16 , m_type(type)
17 #ifndef NDEBUG
18 , m_hasBegunDrawing(false)
19 #endif
23 WebGraphicsContextImpl::~WebGraphicsContextImpl()
27 WebCanvas* WebGraphicsContextImpl::beginDrawing(const WebFloatRect& bounds)
29 #ifndef NDEBUG
30 ASSERT(!m_hasBegunDrawing);
31 m_hasBegunDrawing = true;
32 #endif
33 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(m_graphicsContext, m_client, m_type));
34 m_drawingRecorder = adoptPtr(new DrawingRecorder(m_graphicsContext, m_client, m_type, bounds));
35 WebCanvas* canvas = m_graphicsContext.canvas();
36 ASSERT(canvas);
37 return canvas;
40 void WebGraphicsContextImpl::endDrawing()
42 ASSERT(m_drawingRecorder);
43 m_drawingRecorder.clear();
46 } // namespace blink