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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 namespace blink { | 54 namespace blink { |
55 | 55 |
56 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount, OpacityMode opacityMode) | 56 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount, OpacityMode opacityMode) |
57 { | 57 { |
58 if (!gr) | 58 if (!gr) |
59 return nullptr; | 59 return nullptr; |
60 gr->resetContext(); | 60 gr->resetContext(); |
61 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 61 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
62 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); | 62 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
63 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount, | 63 return adoptRef(SkSurface::NewRenderTarget(gr, SkSurface::kNo_Budgeted, info
, msaaSampleCount, |
64 Opaque == opacityMode ? 0 : &disableLCDProps)); | 64 Opaque == opacityMode ? 0 : &disableLCDProps)); |
65 } | 65 } |
66 | 66 |
67 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) | 67 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) |
68 { | 68 { |
69 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); | 69 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); |
70 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); | 70 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); |
71 if (!contextProvider) | 71 if (!contextProvider) |
72 return nullptr; | 72 return nullptr; |
73 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount, opacityMode)); | 73 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount, opacityMode)); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 535 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
536 // This copy constructor should only be used for Deque::prepend | 536 // This copy constructor should only be used for Deque::prepend |
537 // Assuming 'other' is to be destroyed, we transfer m_image and | 537 // Assuming 'other' is to be destroyed, we transfer m_image and |
538 // m_parentLayerBridge ownership rather than do a refcount dance. | 538 // m_parentLayerBridge ownership rather than do a refcount dance. |
539 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 539 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
540 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 540 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
541 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 541 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
542 } | 542 } |
543 | 543 |
544 } // namespace blink | 544 } // namespace blink |
OLD | NEW |