1cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett/*
2cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * Copyright (C) 2016 The Android Open Source Project
3cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett *
4cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * Licensed under the Apache License, Version 2.0 (the "License");
5cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * you may not use this file except in compliance with the License.
6cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * You may obtain a copy of the License at
7cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett *
8cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett *      http://www.apache.org/licenses/LICENSE-2.0
9cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett *
10cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * Unless required by applicable law or agreed to in writing, software
11cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * distributed under the License is distributed on an "AS IS" BASIS,
12cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * See the License for the specific language governing permissions and
14cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett * limitations under the License.
15cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett */
16cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
17cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett#include "SkiaProfileRenderer.h"
18cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
19cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettnamespace android {
20cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettnamespace uirenderer {
21cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
22cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettvoid SkiaProfileRenderer::drawRect(float left, float top, float right, float bottom,
23cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett        const SkPaint& paint) {
24cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
25cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    mCanvas->drawRect(rect, paint);
26cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett}
27cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
28cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettvoid SkiaProfileRenderer::drawRects(const float* rects, int count, const SkPaint& paint) {
29cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    for (int index = 0; index + 4 <= count; index += 4) {
30cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett        SkRect rect = SkRect::MakeLTRB(rects[index + 0], rects[index + 1], rects[index + 2],
31cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett                rects[index + 3]);
32cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett        mCanvas->drawRect(rect, paint);
33cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    }
34cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett}
35cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
36cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettuint32_t SkiaProfileRenderer::getViewportWidth() {
37cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    return mCanvas->imageInfo().width();
38cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett}
39cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
40cf2c05c652190ddc66f873192c17d193478138a1Matt Sarettuint32_t SkiaProfileRenderer::getViewportHeight() {
41cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett    return mCanvas->imageInfo().height();
42cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett}
43cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett
44cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett} /* namespace uirenderer */
45cf2c05c652190ddc66f873192c17d193478138a1Matt Sarett} /* namespace android */
46