| Index: Source/platform/graphics/paint/CachedDisplayItem.cpp
|
| diff --git a/Source/platform/graphics/paint/CachedDisplayItem.cpp b/Source/platform/graphics/paint/CachedDisplayItem.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3b4e1361eceb3a27036bcfed71d2ee6861f84025
|
| --- /dev/null
|
| +++ b/Source/platform/graphics/paint/CachedDisplayItem.cpp
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "platform/graphics/paint/CachedDisplayItem.h"
|
| +
|
| +#include "platform/graphics/GraphicsContext.h"
|
| +#include "public/platform/WebDisplayItemList.h"
|
| +#include "third_party/skia/include/core/SkPicture.h"
|
| +
|
| +namespace blink {
|
| +
|
| +#ifndef NDEBUG
|
| +
|
| +static void drawRedRect(GraphicsContext& context, const FloatRect& bounds)
|
| +{
|
| + SkPaint paint;
|
| + paint.setColor(SK_ColorRED);
|
| + context.drawRect(bounds, paint);
|
| +}
|
| +
|
| +void CachedDisplayItem::replay(GraphicsContext* context)
|
| +{
|
| + drawRedRect(*context, m_bounds);
|
| +}
|
| +
|
| +void CachedDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const
|
| +{
|
| + GraphicsContext context(nullptr, nullptr);
|
| + context.beginRecording(m_bounds);
|
| + drawRedRect(context, m_bounds);
|
| + RefPtr<const SkPicture> picture = context.endRecording();
|
| + list->appendDrawingItem(const_cast<SkPicture*>(picture.get()), FloatPoint());
|
| +}
|
| +
|
| +#endif // ifndef NDEBUG
|
| +
|
| +} // namespace blink
|
|
|