| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (surface) { | 83 if (surface) { |
| 84 if (opacityMode == Opaque) { | 84 if (opacityMode == Opaque) { |
| 85 surface->getCanvas()->clear(SK_ColorBLACK); | 85 surface->getCanvas()->clear(SK_ColorBLACK); |
| 86 } else { | 86 } else { |
| 87 surface->getCanvas()->clear(SK_ColorTRANSPARENT); | 87 surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 return fromSkSp(surface); | 90 return fromSkSp(surface); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
int msaaSampleCount, OpacityMode opacityMode, AccelerationMode accelerationMode
) | |
| 94 { | |
| 95 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_GLOBAL); | |
| 96 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider = wrapUnique(P
latform::current()->createSharedOffscreenGraphicsContext3DProvider()); | |
| 97 if (!contextProvider) | |
| 98 return nullptr; | |
| 99 RefPtr<Canvas2DLayerBridge> layerBridge; | |
| 100 layerBridge = adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), s
ize, msaaSampleCount, opacityMode, accelerationMode)); | |
| 101 return layerBridge.release(); | |
| 102 } | |
| 103 | |
| 104 Canvas2DLayerBridge::Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DPro
vider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode op
acityMode, AccelerationMode accelerationMode) | 93 Canvas2DLayerBridge::Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DPro
vider> contextProvider, const IntSize& size, int msaaSampleCount, OpacityMode op
acityMode, AccelerationMode accelerationMode) |
| 105 : m_contextProvider(std::move(contextProvider)) | 94 : m_contextProvider(std::move(contextProvider)) |
| 106 , m_logger(wrapUnique(new Logger)) | 95 , m_logger(wrapUnique(new Logger)) |
| 107 , m_weakPtrFactory(this) | 96 , m_weakPtrFactory(this) |
| 108 , m_imageBuffer(0) | 97 , m_imageBuffer(0) |
| 109 , m_msaaSampleCount(msaaSampleCount) | 98 , m_msaaSampleCount(msaaSampleCount) |
| 110 , m_bytesAllocated(0) | 99 , m_bytesAllocated(0) |
| 111 , m_haveRecordedDrawCommands(false) | 100 , m_haveRecordedDrawCommands(false) |
| 112 , m_destructionInProgress(false) | 101 , m_destructionInProgress(false) |
| 113 , m_filterQuality(kLow_SkFilterQuality) | 102 , m_filterQuality(kLow_SkFilterQuality) |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 Canvas2DLayerBridge::MailboxInfo::MailboxInfo() = default; | 991 Canvas2DLayerBridge::MailboxInfo::MailboxInfo() = default; |
| 1003 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) = defaul
t; | 992 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) = defaul
t; |
| 1004 | 993 |
| 1005 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 994 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 1006 { | 995 { |
| 1007 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 996 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
| 1008 hibernationHistogram.count(event); | 997 hibernationHistogram.count(event); |
| 1009 } | 998 } |
| 1010 | 999 |
| 1011 } // namespace blink | 1000 } // namespace blink |
| OLD | NEW |