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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 | 50 |
51 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount = 0) | 51 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size,
int msaaSampleCount = 0) |
52 { | 52 { |
53 if (!gr) | 53 if (!gr) |
54 return nullptr; | 54 return nullptr; |
55 gr->resetContext(); | 55 gr->resetContext(); |
56 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 56 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); | 57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
58 return adoptRef(SkSurface::NewRenderTarget(gr, info, msaaSampleCount, &disa
bleLCDProps)); | 58 return adoptRef(SkSurface::NewRenderTarget(gr, SkSurface::kNo_Budgeted, info
, msaaSampleCount, &disableLCDProps)); |
59 } | 59 } |
60 | 60 |
61 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) | 61 PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(const IntSize& size,
OpacityMode opacityMode, int msaaSampleCount) |
62 { | 62 { |
63 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); | 63 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_
SCOPE_NAME_PROCESS); |
64 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); | 64 OwnPtr<WebGraphicsContext3DProvider> contextProvider = adoptPtr(Platform::cu
rrent()->createSharedOffscreenGraphicsContext3DProvider()); |
65 if (!contextProvider) | 65 if (!contextProvider) |
66 return nullptr; | 66 return nullptr; |
67 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount)); | 67 RefPtr<SkSurface> surface(createSkSurface(contextProvider->grContext(), size
, msaaSampleCount)); |
68 if (!surface) | 68 if (!surface) |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // This copy constructor should only be used for Vector reallocation | 565 // This copy constructor should only be used for Vector reallocation |
566 // Assuming 'other' is to be destroyed, we transfer m_image and | 566 // Assuming 'other' is to be destroyed, we transfer m_image and |
567 // m_parentLayerBridge ownership rather than do a refcount dance. | 567 // m_parentLayerBridge ownership rather than do a refcount dance. |
568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 568 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 569 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); | 570 m_parentLayerBridge = const_cast<MailboxInfo*>(&other)->m_parentLayerBridge.
release(); |
571 m_status = other.m_status; | 571 m_status = other.m_status; |
572 } | 572 } |
573 | 573 |
574 } // namespace blink | 574 } // namespace blink |
OLD | NEW |