OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 | 3125 |
3126 sk_sp<SkImage> povDepthMap; | 3126 sk_sp<SkImage> povDepthMap; |
3127 sk_sp<SkImage> diffuseMap; | 3127 sk_sp<SkImage> diffuseMap; |
3128 | 3128 |
3129 // TODO: pass the depth to the shader in vertices, or uniforms | 3129 // TODO: pass the depth to the shader in vertices, or uniforms |
3130 // so we don't have to render depth and color separately | 3130 // so we don't have to render depth and color separately |
3131 | 3131 |
3132 // povDepthMap | 3132 // povDepthMap |
3133 { | 3133 { |
3134 SkLights::Builder builder; | 3134 SkLights::Builder builder; |
3135 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f), | 3135 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
3136 SkVector3::Make(0.0f, 0.0f, 1.0f))); | 3136 SkVector3::Make(0.0f, 0.0f,
1.0f))); |
3137 sk_sp<SkLights> povLight = builder.finish(); | 3137 sk_sp<SkLights> povLight = builder.finish(); |
3138 | 3138 |
3139 SkImageInfo info = SkImageInfo::Make(picture->cullRect().width(), | 3139 SkImageInfo info = SkImageInfo::Make(picture->cullRect().width(), |
3140 picture->cullRect().height(), | 3140 picture->cullRect().height(), |
3141 kBGRA_8888_SkColorType, | 3141 kBGRA_8888_SkColorType, |
3142 kOpaque_SkAlphaType); | 3142 kOpaque_SkAlphaType); |
3143 | 3143 |
3144 // Create a new surface (that matches the backend of canvas) | 3144 // Create a new surface (that matches the backend of canvas) |
3145 // to create the povDepthMap | 3145 // to create the povDepthMap |
3146 sk_sp<SkSurface> surf(this->makeSurface(info)); | 3146 sk_sp<SkSurface> surf(this->makeSurface(info)); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3293 | 3293 |
3294 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3294 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3295 fCanvas->restoreToCount(fSaveCount); | 3295 fCanvas->restoreToCount(fSaveCount); |
3296 } | 3296 } |
3297 | 3297 |
3298 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3298 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3299 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3299 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3300 return this->makeSurface(info, props).release(); | 3300 return this->makeSurface(info, props).release(); |
3301 } | 3301 } |
3302 #endif | 3302 #endif |
OLD | NEW |